[postgis-users] Setting Units in PostGIS

Gustavo Henrique Sberze Ribas gribas at cpqd.com.br
Mon May 2 16:11:06 PDT 2005


Hello,

 Like Markus said, if you apply area() to coordinates in lat/long you'll
get a result in degrees^2... Not only is it hard to imagine but it's
also wrong, since you're applying 2D planar formulas to an ellipsoidal coordinate system.

 If your coordinates are in a carthesian system you're done, just
convert the result to the unit you like most.

 If not you'll have to project your coordinates on a plane in order
to apply the desired formulas. That's not as difficult as it sounds,
PostGIS will do most of the hard work for you. For example, you
could translate all your coordinates to UTM (unit=meters), apply
area() and then multiply the result by the proper factor 
(1000 meters = 0.621371192 miles).

 Of course, If you truly like precision and math you could try to 
deduce an area formula for an ellipsoidal system... :)


--
Gustavo

>> I’m a newby to PostGIS and have what I believe is a simple question. 
>> How do I determine what units PostGIS is returning?  When I calculate
>> the area of a polygon or the distance of a line segment, how can I set
>> it to return Square Miles or miles or feet?
>> Any help would be greatly appreciated.

>That completely depends on the units your data is measured in. If your
>data coordinates are in a carthesian system, then distances are the same
>units as the coordinate units, and areas are the squared unit.

>If your data coordinates are in lat/long or something else, then
>distance and area calculations are rather unusable, you will need
>something like distance_sphere() then.

>Markus


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3397 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050502/106d3e4c/attachment.bin>


More information about the postgis-users mailing list