[postgis-users] Calculation distance between two points
iKey
eike.lueders at gmail.com
Wed Jan 19 06:40:59 PST 2011
Dear Community,
I want to calculate the distance between two points with a postgres query.
The point reference system of my DB is epsg 4326. As far as I know I have to
transform them, because with
WGS84 4326 I can calculate the distance in radian only.
This is an example query in that I try to calculate the distance in
different ways, but with no luck so far :(
SELECT ST_Distance(ST_Transform(ST_GeomFromText('POINT(52.278888888889
8.0430555555556)',4326),
900913),ST_Transform(ST_GeomFromText('POINT(52.2812598 8.036165)', 4326),
900913))
,ST_Distance_Sphere(ST_GeomFromText('POINT(52.278888888889
8.0430555555556)',4326), ST_GeomFromText('POINT(52.2812598 8.036165)',
4326))
,ST_Distance_Spheroid(ST_GeomFromText('POINT(52.278888888889
8.0430555555556)',4326), ST_GeomFromText('POINT(52.2812598 8.036165)',
4326), 'SPHEROID["WGS 84",6378137,298.257223563]')
FROM pois
LIMIT 1;
The results look like this
818.392971975843;
809.44384291019;
805.637737963218
When i calculate the distance in GoogleEarth or GoogleMaps I get a result
about 538,06m, so I think there is going something wrong in my
calculation with postgres.
Does anyone has any ideas whats going wrong or what else I can try?
Best regards
Eike
--
View this message in context: http://old.nabble.com/Calculation-distance-between-two-points-tp30710456p30710456.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
More information about the postgis-users
mailing list