<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16625"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff 
size=2 face=Arial>Nguyen,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff 
size=2 face=Arial>1) If you care about accurate measurement, don't use <FONT 
color=#000000 size=3 face="Times New Roman"><FONT color=#0000ff>SRID 
900913.  It is grossly inaccurate for measurement and was designed 
specifically for map visualization.</FONT></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff>2) If 
you are using PostGIS 1.5, you may want to store your long lat data in 
geography data type.  It will allow you to keep data in degrees, but will 
give you answers in meters for measurement.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT 
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff>This 
FAQ might help you decide</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff 
size=2 face=Arial><A 
href="http://www.postgis.org/documentation/manual-svn/ch04.html#PostGIS_GeographyVSGeometry">http://www.postgis.org/documentation/manual-svn/ch04.html#PostGIS_GeographyVSGeometry</A></FONT></SPAN></DIV></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT 
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff>3) 
Using 32611 is best assuming its right for your area if you are dealing with 
just that region and want the full geometry processing, speed power, or 
using  PostGIS < 1.5</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT 
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT 
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff>Leo 
and Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT color=#0000ff><A 
href="http://www.postgis.us">http://www.postgis.us</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT 
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=067552010-24082010><FONT 
color=#0000ff></FONT></SPAN> </DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> 
postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
</B>nguyen liem<BR><B>Sent:</B> Monday, August 23, 2010 11:55 PM<BR><B>To:</B> 
PostGIS Users Discussion<BR><B>Subject:</B> [postgis-users] How to use accurate 
SRID ?<BR></FONT><BR></DIV>
<DIV></DIV>Hi all,<BR><BR>I stored all my geometry in SRID 4326. I would like to 
calculate the distance between 2 points in metter. 
<BR><BR>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<BR>I 
see an example about ST_Distance_Sphere here: <A 
href="http://postgis.refractions.net/docs/ST_Distance_Sphere.html">http://postgis.refractions.net/docs/ST_Distance_Sphere.html</A><BR><BR><PRE class=programlisting>SELECT round(CAST(ST_Distance_Sphere(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326)) As numeric),2) As dist_meters,<BR>
round(CAST(ST_Distance(ST_Transform(ST_Centroid(the_geom),32611),<BR>             ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As dist_utm11_meters,<BR>round(CAST(ST_Distance(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)', 4326)) As numeric),5) As dist_degrees,<BR>
round(CAST(ST_Distance(ST_Transform(the_geom,32611),<BR>          ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As min_dist_line_point_meters<BR>FROM<BR>       (SELECT ST_GeomFromText('LINESTRING(-118.584 38.374,-118.583 38.5)', 4326) As the_geom) as foo;<BR>
         dist_meters | dist_utm11_meters | dist_degrees | min_dist_line_point_meters<BR>  -------------+-------------------+--------------+----------------------------<BR>         70424.47 |         <B style="COLOR: rgb(0,102,0)"><FONT size=4>70438.00</FONT></B> |      0.72900 |                   65871.18<BR>
</PRE><BR><SPAN style="COLOR: rgb(0,153,0)">SRID 32611: the distance is 
</SPAN><B style="COLOR: rgb(0,153,0)"><FONT size=+0><B><FONT 
size=4>70438.00</FONT></B></FONT></B><SPAN style="COLOR: rgb(0,153,0)"> 
metters.</SPAN><BR><BR>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<BR>If 
i changed SRID from 32611 to 900913<BR><BR><PRE class=programlisting> dist_meters | dist_utm11_meters | dist_degrees | min_dist_line_point_meters<BR>   -------------+-------------------+--------------+----------------------------<BR>         70424.47 |         <FONT style="COLOR: rgb(0,102,0)" size=4><B>89738.89</B></FONT> |      0.72900 |                   83857.70</PRE><BR><SPAN 
style="COLOR: rgb(0,102,0)">SRID 32611: the distance is </SPAN><FONT 
style="COLOR: rgb(0,102,0)" size=4><B>89738.89</B></FONT><SPAN 
style="COLOR: rgb(0,102,0)"> metters</SPAN><BR><PRE class=programlisting><BR></PRE>I don't know what is the different between 
SRID 32611 and SRID 900913 ?<BR>I should use 32611 or 900913 to calculate the 
distance in metter ?<BR>Could i calculate distance by ST_Distance_Sphere for 
geometry with SRID 4326 ?<BR>Whats the different between ST_Distance_Sphere(SRID 
4326), ST_Distance(SRID 32611), ST_Distance (SRID 900913) ?<BR><BR>Cheers.<BR 
clear=all><BR>-- <BR>
<DIV>
<DIV style="MARGIN: 0in 0in 0pt"><B><SPAN 
style="COLOR: rgb(31,73,125); FONT-SIZE: 8pt"><FONT face=Calibri>Liem Nguyen 
(DBA)<BR><BR>AXON ACTIVE VIETNAM</FONT></SPAN></B></DIV>
<DIV style="MARGIN: 0in 0in 0pt"><B><SPAN 
style="COLOR: rgb(31,73,125); FONT-SIZE: 8pt" lang=DE-CH><A 
href="http://www.axonactive.vn/" target=_blank><SPAN lang=EN-US><FONT 
color=#0000ff 
face=Calibri>www.axonactive.vn</FONT></SPAN></A></SPAN></B><B><SPAN 
style="COLOR: rgb(31,73,125); FONT-SIZE: 8pt"></SPAN></B></DIV>
<DIV style="MARGIN: 0in 0in 0pt"><SPAN 
style="COLOR: rgb(31,73,125); FONT-SIZE: 8pt"><FONT 
face=Calibri></FONT></SPAN> </DIV>
<DIV style="MARGIN: 0in 0in 0pt"><SPAN 
style="COLOR: rgb(31,73,125); FONT-SIZE: 8pt"><FONT face=Calibri>10th Floor, Hai 
Au Building, 39B Truong Son, Ward 4, Tan Binh District, Ho Chi Minh City, 
Vietnam</FONT></SPAN></DIV>
<DIV style="MARGIN: 0in 0in 0pt"><SPAN 
style="COLOR: rgb(31,73,125); FONT-SIZE: 8pt"><FONT face=Calibri>T +84 8 629 738 
59, F +84 8 381 134 89, M +84 168 994 8897</FONT></SPAN></DIV>
<DIV style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 8pt"><FONT 
size=1><U>8897 +10° 48' 32.72", +106° 39' 51.58"</U></FONT></SPAN></DIV><PRE><BR></PRE></DIV><BR></BODY></HTML>