wiki:UsersWikiNewbiePostGISFunctionMeasurement

Newbie Question

What unit of measurement do PostGIS geometry functions use?

Almost all functions used in PostGIS assume measurement is in the units of the spatial reference system except for the functions that have sphere/spheroid in their name or the geography functions and type introduced in PostGIS 1.5.

The ones with sphere/spheriod in their name:

  • Always return measurement in meters
  • Assume your geometry is in longlat (degrees) regardless of what your stated SRID is.
  • Those functions only work with points

This means if you put "SRID = -1" your units are units (or rather what you think your data's coordinate system is).

  • For example if you were using

PostGIS to plot out the infrastructure of an Ant Farm and your measurements of the perimeters are in units of millimeters, then all your lengths, areas etc would be in millimeters.

If you have an SRID = 4326 - then you are basically telling PostGIS that your units are degrees and all your measurements are meaningless except for the functions with the words spheroid and sphere in them.

So basically PostGIS only thinks in numbers not units and the units are more meta-data than anything else. If your data is really in degrees and you import it stating it is a meter based one, your data is still in degrees (unless you transform from what the spatial reference system actually is to what you want it to be).

Last modified 7 years ago Last modified on Dec 2, 2009 10:41:49 AM