[postgis-users] coordinate order of geometry vs coordinate order of gml

Rushforth, Peter Peter.Rushforth at NRCan-RNCan.gc.ca
Thu May 28 05:59:33 PDT 2015


> Since everything is wrong except for GML, which has to reverse things that
> are correct in order to do the "right" thing vis-a-vis GML, my guess is that the
> data were loaded in the wrong order to start with.

The data were loaded with ST_GeomFromGML, where the GML coordinate order
was "correct" according to EPSG: 4326.

> > I noticed that on this documentation page there are two coordinate
> > orders for apparently a similar area in North America (?) - EPSG:4269, but
> perhaps this is unrelated.
> >
> > http://postgis.net/docs/ST_GeomFromGML.html

The first example above shows the coordinates in lon-lat order, which of course 
would result in a correct geometry in postgis, whereas the second is apparently
lat-lon. 


> That is, if you run ST_AsText() you'll find the coordinates in Lat-Lon order,
> when the expectation is that they are in Lon-Lat order.
> 
> To fix,
> 
> update mytable set geom = st_flipcoordinates(geom)
> 
> http://postgis.net/docs/ST_FlipCoordinates.html

 Thanks.  Good to know about.

Peter


More information about the postgis-users mailing list