<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>RE: [postgis-users] Setting Units in PostGIS</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>If area is being measured, I’d suggest you
select an equal-area projection as well.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>--Craig<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Gustavo Henrique Sberze Ribas<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, May 02, 2005 4:11 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">PostGIS
 Users Discussion</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [postgis-users]
Setting Units in PostGIS</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>Hello,</span></font>
<o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'> Like
Markus said, if you apply area() to coordinates in lat/long you'll</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>get a result in degrees^2... Not
only is it hard to imagine but it's</span></font> <br>
<font size=2><span style='font-size:10.0pt'>also wrong, since you're applying
2D planar formulas to an ellipsoidal coordinate system.</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'> If
your coordinates are in a carthesian system you're done, just</span></font> <br>
<font size=2><span style='font-size:10.0pt'>convert the result to the unit you
like most.</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'> If
not you'll have to project your coordinates on a plane in order</span></font> <br>
<font size=2><span style='font-size:10.0pt'>to apply the desired formulas.
That's not as difficult as it sounds,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>PostGIS will do most of the hard
work for you. For example, you</span></font> <br>
<font size=2><span style='font-size:10.0pt'>could translate all your
coordinates to UTM (unit=meters), apply</span></font> <br>
<font size=2><span style='font-size:10.0pt'>area() and then multiply the result
by the proper factor </span></font><br>
<font size=2><span style='font-size:10.0pt'>(1000 meters = 0.621371192 miles).</span></font>
<o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'> Of
course, If you truly like precision and math you could try to </span></font><br>
<font size=2><span style='font-size:10.0pt'>deduce an area formula for an
ellipsoidal system... :)</span></font> <o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>--</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>Gustavo</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>>> I’m
a newby to PostGIS and have what I believe is a simple question. </span></font><br>
<font size=2><span style='font-size:10.0pt'>>> How do I determine what
units PostGIS is returning?  When I calculate</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> the area of a polygon or
the distance of a line segment, how can I set</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> it to return Square Miles
or miles or feet?</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> Any help would be greatly
appreciated.</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>>That
completely depends on the units your data is measured in. If your</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>data coordinates are in a
carthesian system, then distances are the same</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>units as the coordinate units,
and areas are the squared unit.</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>>If
your data coordinates are in lat/long or something else, then</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>distance and area calculations
are rather unusable, you will need</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>something like
distance_sphere() then.</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>>Markus</span></font>
<o:p></o:p></p>

</div>

</body>

</html>