[postgis-users] Third dimension units

Gilles Bassière gilles.bassiere at makina-corpus.com
Thu Nov 12 03:06:25 PST 2009


Hi list,

I'm trying to make a 3D point from a 2D point (in WGS84 geographic
coordinates) and an attribute representing depth (in meters).

My first attempt was to convert the 2D point to World Mercator in order
to have latitude and longitude in meters but I don't know how to
interpret the results:

Let's take this arbitrary point: 18°E, 25°N, 100m deep. I tried these
queries:

=> -- Convert 2D point to a metric coordinate system (World Mercator)
=> SELECT ST_AsEWKT(ST_Transform(
(>   ST_SetSRID(
(>     ST_MakePoint(
(>       ST_X(ST_Transform(ST_GeomFromText('POINT(18 25)', 4326), 3395)),
(>       ST_Y(ST_Transform(ST_GeomFromText('POINT(18 25)', 4326), 3395)),
(>       -100),
(>     3395),
(>  4326));
                 st_asewkt
-------------------------------------------
 SRID=4326;POINT(18 24.9999999999992 -100)
(1 row)

=> -- Keep original coordinate in degrees
=> SELECT ST_AsEWKT(
(>   ST_SetSRID(
(>     ST_MakePoint(
(>       ST_X(ST_GeomFromText('POINT(18 25)', 4326)),
(>       ST_Y(ST_GeomFromText('POINT(18 25)', 4326)),
(>       -100),
(>   4326));
          st_asewkt
-----------------------------
 SRID=4326;POINT(18 25 -100)
(1 row)


I've always thought that WGS84 is expressed in decimal degrees for *all*
dimension (even if 100° deep does not make sense to me).
Does this means that Z coordinates are always expressed in meters? How
does ST_Transform normally behaves with 3rd coordinate?

Regards,

-- 
Gilles Bassière - MAKINA CORPUS
http://www.makina-corpus.com



More information about the postgis-users mailing list