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* *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
