Nguyen, 1) If you care about accurate measurement, don't use SRID 900913. It is grossly inaccurate for measurement and was designed specifically for map visualization. 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. This FAQ might help you decide http://www.postgis.org/documentation/manual-svn/ch04.html#PostGIS_GeographyV SGeometry 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 Leo and Regina http://www.postgis.us
_____ From: [email protected] [mailto:[email protected]] On Behalf Of nguyen liem Sent: Monday, August 23, 2010 11:55 PM To: PostGIS Users Discussion Subject: [postgis-users] How to use accurate SRID ? Hi all, I stored all my geometry in SRID 4326. I would like to calculate the distance between 2 points in metter. ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------- I see an example about ST_Distance_Sphere here: http://postgis.refractions.net/docs/ST_Distance_Sphere.html SELECT round(CAST(ST_Distance_Sphere(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326)) As numeric),2) As dist_meters, round(CAST(ST_Distance(ST_Transform(ST_Centroid(the_geom),32611), ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As dist_utm11_meters, round(CAST(ST_Distance(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)', 4326)) As numeric),5) As dist_degrees, round(CAST(ST_Distance(ST_Transform(the_geom,32611), ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As min_dist_line_point_meters FROM (SELECT ST_GeomFromText('LINESTRING(-118.584 38.374,-118.583 38.5)', 4326) As the_geom) as foo; dist_meters | dist_utm11_meters | dist_degrees | min_dist_line_point_meters -------------+-------------------+--------------+--------------------------- - 70424.47 | 70438.00 | 0.72900 | 65871.18 SRID 32611: the distance is 70438.00 metters. ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------- If i changed SRID from 32611 to 900913 dist_meters | dist_utm11_meters | dist_degrees | min_dist_line_point_meters -------------+-------------------+--------------+--------------------------- - 70424.47 | 89738.89 | 0.72900 | 83857.70 SRID 32611: the distance is 89738.89 metters I don't know what is the different between SRID 32611 and SRID 900913 ? I should use 32611 or 900913 to calculate the distance in metter ? Could i calculate distance by ST_Distance_Sphere for geometry with SRID 4326 ? Whats the different between ST_Distance_Sphere(SRID 4326), ST_Distance(SRID 32611), ST_Distance (SRID 900913) ? Cheers. -- Liem Nguyen (DBA) AXON ACTIVE VIETNAM <http://www.axonactive.vn/> www.axonactive.vn 10th Floor, Hai Au Building, 39B Truong Son, Ward 4, Tan Binh District, Ho Chi Minh City, Vietnam T +84 8 629 738 59, F +84 8 381 134 89, M +84 168 994 8897 8897 +10° 48' 32.72", +106° 39' 51.58"
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
