[postgis-users] WGS-84 coordinates in geometry
Obe, Regina
robe.dnd at cityofboston.gov
Mon Sep 24 12:45:03 PDT 2007
That would return it in degrees. ST_Distance always returns in the
units of the projection - in this case degrees.
Since you are just dealing with points. You can use the following
instead which will always return meters
SELECT ST_Distance_Sphere(
GeomFromText('POINT(5.0 52.0)', 4326),
GeomFromText('POINT(6.0 56.0)', 4326) );
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Sidney Cadot
Sent: Monday, September 24, 2007 3:33 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] WGS-84 coordinates in geometry
Dear all,
Being a complete newcomer to GIS, I have what may well be a rather
simple
problem.
Given that I have two WGS-84 points: (5 degrees East, 52 degrees North);
and
(6 degrees East, 56 degrees North), sitting at altitude zero on the
ellipsoid surface. I want to put objects with these sort of coordinates
in a
PostGIS database.
Now I was expecting that I could just represent them as points in a
selected
SIR (4326 corresponds to standard WGS-84, I believe) using
latitude/longitude values.
Following this, I would have expected to be able to find their distance
over
the WGS-84 ellipsoid as follows:
SELECT ST_Distance(
GeomFromText('POINT(5.0 52.0)', 4326),
GeomFromText('POINT(6.0 56.0)', 4326) );
which I sort of expected to return the distance in meters between those
two
points over the surface of the WGS-84 ellipsoid, which should yield a
value
of approx. 450009.761 meters.
Alas, I get back a value of 11.045...., which is the square root of 122,
which is simply the euclidean distance between (5 52) and (6 56).
Given this, my question is as follows: is my suspicion correct that
POINT()s
and other geometrical objects assume a flat (euclidean) surface? Should
I
first transform my WGS-84 (latitude,longitude) coordinates to a flat
(euclidean) coordinate system using a map projection?
If so, what would be the easiest way to do this transformation within
Postgres/Postgis? To put it in concrete terms: which query would start
with
the values 5, 52, 6, and 56 (to be interpreted as WGS-84
latitude/longitudes), and yield the value 450009.761 (their distance in
meters)? Is this even possible?
As a last question: if Postgis handles euclidian geometry only, does
this
also mean that things like intersection tests etc. are performed on the
projected (2D) representation of the geometry?
For example, in correct ellipsoid geometry, a "straight line" (geoid) on
the
WGS-84 ellipsoid from (lat=45,lon=0) to (lat=45,lon=90) should intersect
the
"straight line" (geoid) from (lat=45.000001, lon=45) to (lat=89,
lon=45).
Can PostGIS help to handle such cases correctly?
Any help is much appreciated.
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
More information about the postgis-users
mailing list