[postgis-devel] [PostGIS] #1990: Inconsistent X/Y coordinates swapping in GML

PostGIS trac at osgeo.org
Mon Sep 10 15:08:58 PDT 2012


#1990: Inconsistent X/Y coordinates swapping in GML
----------------------+-----------------------------------------------------
 Reporter:  xificurk  |       Owner:  pramsey      
     Type:  defect    |      Status:  new          
 Priority:  medium    |   Milestone:  PostGIS 2.0.2
Component:  postgis   |     Version:  2.0.x        
 Keywords:            |  
----------------------+-----------------------------------------------------
 ST_AsGML always outputs coordinates in order X,Y.

 => SELECT st_asgml(st_setsrid(st_makepoint(15, 50), 4326), 15, 0);
  <gml:Point
 srsName="EPSG:4326"><gml:coordinates>15,50</gml:coordinates></gml:Point>

 => SELECT st_asgml(st_setsrid(st_makepoint(15, 50), 4326), 15, 1);
  <gml:Point
 srsName="urn:ogc:def:crs:EPSG::4326"><gml:coordinates>15,50</gml:coordinates></gml:Point>

 => SELECT st_asgml(st_setsrid(st_makepoint(15, 50), 4326), 15, 16);
  <gml:Point
 srsName="EPSG:4326"><gml:coordinates>15,50</gml:coordinates></gml:Point>


 On the other hand, ST_GeomFromGML swaps coordinates, if given srsName in
 format like 'urn:ogc:def:crs:EPSG::4326' instead of simple 'EPSG:4326'.
 Although the examples use 4326 SRS, it does not depend on this exact
 setting.

 => SELECT st_astext(st_geomfromgml('<gml:Point
 xmlns:gml="http://www.opengis.net/gml/3.2"
 srsName="urn:ogc:def:crs:EPSG::4326"><gml:coordinates>15,50</gml:coordinates></gml:Point>'));
  POINT(50 15)

 ruian=> SELECT st_astext(st_geomfromgml('<gml:Point
 xmlns:gml="http://www.opengis.net/gml/3.2"
 srsName="EPSG:4326"><gml:coordinates>15,50</gml:coordinates></gml:Point>'));
  POINT(15 50)


 Tested on 64bit Gentoo setup with fresh postgis install on top of
 PostgreSQL 9.1.5.
 POSTGIS="2.0.1 r9979" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.8.0, 6 March
 2012" LIBXML="2.8.0"

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1990>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list