[postgis-users] ST_Distance issue

Archana Sachin Ghag Archana_Ghag at infosys.com
Thu Nov 17 19:46:40 PST 2011


I am calculating distance from my current location with all available regions(polygons) in my table.
I am using ST_Distance method for this.
My regions are stored with SRID = 900913.

Distance for point in Europe from USA region is coming as 122.78.
How come this possible. These regions are so far.

Here is my query. Can you please suggest me how can I get actual distance in meters here.

SELECT ST_distance
(st_geomfromtext('point(-123.574219125 47.8131546948944 0)', 900913),
st_geomfromtext('LINESTRING(-0.791015625 48.4874864798841,9.4921875 54.5975278521139,27.59765625 55.3541353102106,36.38671875 48.3124279040718,22.32421875 40.3465441211801,5.888671875 43.8662180065564,-0.791015625 48.4874864798841)', 900913)
)

Query returns 122.785055218779


SELECT ST_Distance_Sphere
(st_geomfromtext('point(-123.574219125 47.8131546948944 0)', 900913),
st_geomfromtext('LINESTRING(-0.791015625 48.4874864798841,9.4921875 54.5975278521139,27.59765625 55.3541353102106,36.38671875 48.3124279040718,22.32421875 40.3465441211801,5.888671875 43.8662180065564,-0.791015625 48.4874864798841)', 900913)
)

Query returns 7808837.70565995

But still its less only as this in in meters. Is it bcs I m calculating distance between point and polygon.
ST_Distance_Sphere works great for point to point distance.
What is significance of SRID here. Am I missing something?
Which SRID should we use for general purpose.


Thanks,
Archana Ghag
----------------------------------------------------
Technology Architect
Microsoft Technology Center
Infosys Technologies Limited
B1, IT Park 1, Hinjawadi, Pune - 411057
Tel:  2022978913(VOIP) : +91-9850872739 (Mobile)
email: archana_ghag at infosys.com<mailto:archana_ghag at infosys.com>


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111118/2c398ebf/attachment.html>


More information about the postgis-users mailing list