PostGIS Length Calculation – Using ST_Length (GEOM, true) for Calculating Distances in Geographic Reference System

coordinate systemlengthpostgis-2.0

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: https://postgis.net/docs/ST_Length.html

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

Best Answer

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.

Related Question