Friday 14 October 2016

coordinate system - PostGIS GML round trip confusion


I've investigated the issue of coordinate order in GML and each time I think I've got it but I find my self confused once again.


I think some of my confusion may be to do with PostGIS. Doing a simple query on my database I can see the coordinates are stored correctly. The st_asgml function is outputting these coordinates in long,lat order which I think is correct for this srsName:


select title, ST_AsGML(3, locationgeometry, 15, 1), xmin(locationgeometry), ymin(locationgeometry) from tblobject where title='Chuska East Ridge';
-[ RECORD 1 ]-------------------------------------------------------------------------------
title | Chuska East Ridge

st_asgml | -108.848780000000005 36.078707000000001
xmin | -108.84878
ymin | 36.078707

However, if I take the same GML output above and run it through st_geomfromgml, the coordinates appear to have been reversed:


select xmin(st_geomfromgml('-108.848780000000005 36.078707000000001'));
-[ RECORD 1 ]---
xmin | 36.078707

Am I missing something, or is this a bug in PostGIS? Can someone please confirm for me once and for all whether I should have lat,lon or lon,lat in GML when using the srsName urn:ogc:def:crs:EPSG::4326?




  • PostgreSQL version: 9.1.14

  • PostGIS version : POSTGIS="1.5.3" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.8" USE_STATS




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...