I use (1) ST_Length (ST_Transform (geom, 3395)) to get distances in meters from points in Geographic Reference Systems EPSG: 4326. The thing is I found that with (2) ST_Length (geom, true) you can get also the distance in meters but using the spheroid.

If I am right, is the option (2) more accurate if the GIS project use a Geographic Reference System for Global data, especially near to the poles?

ST_Length reference: http://postgis.org/docs/ST_Length.html

EPSG:3395 reference: http://spatialreference.org/ref/epsg/3395/


You can if your data is stored in a geography column, or cast from geometry to geography. If you run ST_Length against geometry it will return the units the data is stored in (feet, meters, degrees), if you run ST_Length against geography it will return the answer in meters.

See this workshop for details on the difference.

  • In my opinion, HeyOverThere's answer is more precise that mkennedy's one. And also it makes me notice that I was using the wrong data type for working with Global Data, I should use "geography" type instead of "geometry". Anyway thanks to both of you for your answers. Jan 24 '14 at 9:09

EPSG:3395 uses the Mercator projection. Mercator is not designed for distance calculations, instead it preserves shapes/angles, so yes, option 2, will give more accurate distances.

  • This answer is also correct because doing ST_Length (geom, true) is equivalent to cast from geometry to geography like doing ST_Length (geom::geography) Jan 24 '14 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.