[postgis-users] Z coordinate value changes with st_transform

Sandro Santilli strk at keybit.net
Mon Apr 2 00:22:57 PDT 2012


Thanks for the heads up Richard. Sounds like important information,
could you add it to the ticket ?
http://trac.osgeo.org/postgis/ticket/1742

If what you say is correct we really want to always omit
transforming Z from ST_Transform().

--strk;

On Fri, Mar 30, 2012 at 05:59:16PM -0600, Richard Greenwood wrote:
> Others more knowledgeable than myself should probably weight in on
> this, but I don't believe the Z value from a horizontal datum
> transform should be applied to an orthometric or ellipsoidal Z value.
> Proj.4 returns a Z value which is a delta when transforming lat/long
> (with no heights) between different datums when doing a 3 or 7
> parameters datum transform (but not a grid shift tranform). 3 and 7
> parameters transforms are done in XYZ geocentric space and the Z value
> is just the "artifact" but does not represent a geographic change in
> height.
> 
> The vertical datum support in Proj.4 is new and I don't think it is
> what you are seeing here. If I'm correct in my assumptions then there
> should be a ST_Transform() and a ST_Transform3D(). The Z value should
> be disregarded in ST_Transform() and in ST_Transform3D() vertical
> transformation should be explicitly requested from the Proj.4 lid.
> 
> Rich
> 
> On Fri, Mar 30, 2012 at 1:30 PM, Paul Ramsey <pramsey at opengeo.org> wrote:
> > Turns out this is just because the definition of 23030 has been
> > updated to include a to_wgs84 parameter. You get the same behavior in
> > any version of proj. This is a feature, not a bug (our projection
> > information is now better). If you want the old behaviour, change the
> > proj4text of 23030 back to the 1.5 version.
> >
> > For a future release you might file a ticket to allow users to apply
> > transforms x/y but to skip the z-coordinate.
> >
> > P.
> >
> > On Fri, Mar 30, 2012 at 10:27 AM, Paul Ramsey <pramsey at opengeo.org> wrote:
> >> Yeah, bad news, 2.0 is showing this behavour but not 1.5.
> >>
> >> http://trac.osgeo.org/postgis/ticket/1742
> >>
> >> P.
> >>
> >> On Fri, Mar 30, 2012 at 9:59 AM, Stefano Iacovella
> >> <stefano.iacovella at gmail.com> wrote:
> >>> Hi Jose
> >>>
> >>> Im sure which version of PostGis are you using.
> >>> On my box, Postgis 1.5.3 with Proj 4.8 it seems to work without any
> >>> change to elevation:
> >>>
> >>> template_postgis=# select
> >>> st_asewkt(st_transform(st_geomfromtext('POINT (700000 4500000 100)',
> >>> 23030), 4326));
> >>> WARNING:  OGC WKT expected, EWKT provided - use GeomFromEWKT() for this
> >>>                        st_asewkt
> >>> ----------------------------------------------------------
> >>>  SRID=4326;POINT(-0.635451186670006 40.6259397158234 100)
> >>> (1 row)
> >>>
> >>>
> >>> template_postgis=# select postgis_full_version();
> >>>                                       postgis_full_version
> >>>
> >>> --------------------------------------------------------------------------------
> >>> ------------------
> >>>  POSTGIS="1.5.3" GEOS="3.3.2-CAPI-1.7.2" PROJ="Rel. 4.8.0, 6 March 2012" LIBXML=
> >>> "2.7.6" USE_STATS
> >>> (1 row)
> >>>
> >>>
> >>> Regards
> >>>
> >>> Stefano
> >>>
> >>> 2012/3/30 Jose Carlos Martinez <jomarlla at cgf.upv.es>:
> >>>> I didnt get nay answers from now.
> >>>> Someone can tell me why postgis is changing the z coordinate and how i can
> >>>> change this default behavior?
> >>>> Should I keep using  proj4.7 instead of proj4.8?
> >>>>
> >>>>
> >>>> Before:
> >>>> pg20=# select st_astext(st_transform(st_geomfromtext('POINT (700000 4500000
> >>>> 100)', 23030), 4326));
> >>>>                          st_astext
> >>>> --------------------------------------------------------------
> >>>>  POINT Z (-0.63662073736203 40.6248036513963 100)
> >>>>
> >>>>
> >>>> Now:
> >>>> pg20=# select st_astext(st_transform(st_geomfromtext('POINT (700000 4500000
> >>>> 100)', 23030), 4326));
> >>>>                          st_astext
> >>>> --------------------------------------------------------------
> >>>>  POINT Z (-0.63662073736203 40.6248036513963 168.35361468256)
> >>>>
> >>>>
> >>>>
> >>>> On 27/03/2012 21:56, Jose Carlos Martinez Llario wrote:
> >>>>>
> >>>>> From proj4.8 changelog:
> >>>>>
> >>>>> "Preliminary support has been added for vertical datums using the
> >>>>> +geoidgrids= directive.  The geoidgrids are assumed to provide a
> >>>>> transformation from geoid elevations to ellipsoidal elevations and they are
> >>>>> discussed a bit in the VerticalDatums topic on the web site"
> >>>>>
> >>>>> I dont like the st_transform method can change my z coordinates by default
> >>>>> though, dont know if it is because PostGIS is not ready still for proj4.8 or
> >>>>> because it is the proj4.8 default behaviour.
> >>>>>
> >>>>> cheers,
> >>>>> Jose
> >>>>>
> >>>>>
> >>>>> On 27/03/2012 19:02, Jose Carlos Martinez wrote:
> >>>>>>
> >>>>>> Hi, dont know if this is the expected behavior, maybe its because I built
> >>>>>> postgis with proj 4.8 or because something has changed in spatial_ref_sys.
> >>>>>> Dont know at what time it happened (I missed it).
> >>>>>>
> >>>>>> Before:
> >>>>>> pg20=# select st_astext(st_transform(st_geomfromtext('POINT (700000
> >>>>>> 4500000 100)', 23030), 4326));
> >>>>>>                          st_astext
> >>>>>> --------------------------------------------------------------
> >>>>>>  POINT Z (-0.63662073736203 40.6248036513963 100)
> >>>>>>
> >>>>>>
> >>>>>> Now:
> >>>>>> pg20=# select st_astext(st_transform(st_geomfromtext('POINT (700000
> >>>>>> 4500000 100)', 23030), 4326));
> >>>>>>                          st_astext
> >>>>>> --------------------------------------------------------------
> >>>>>>  POINT Z (-0.63662073736203 40.6248036513963 168.35361468256)
> >>>>>>
> >>>>>> Using ST_AsKml Its changing the Z coordinate too.
> >>>>>>
> >>>>>> Someone can confirm when this change happened in PostGIS?
> >>>>>>
> >>>>>> Regards,
> >>>>>> Jose
> >>>>>>
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> postgis-users mailing list
> >>>>>> postgis-users at postgis.refractions.net
> >>>>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>>>
> >>>>>
> >>>>
> >>>> _______________________________________________
> >>>> postgis-users mailing list
> >>>> postgis-users at postgis.refractions.net
> >>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> _______________________________________________
> >>> postgis-users mailing list
> >>> postgis-users at postgis.refractions.net
> >>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> 
> -- 
> Richard Greenwood
> richard.greenwood at gmail.com
> www.greenwoodmap.com
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

-- 

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'




More information about the postgis-users mailing list