I've asked this question many times:"Bone-pressed" on the top side. Basically, the ruler would be on top of the D, pressed in towards the pubic bone a bit. Random dudes measuring themselves might do it from the side or bottom to make it sound longer, but AFAIK that's the standard for studies.
What is the universal measurement method for dicks?