[Gdal-dev] OGR2OGR GML coordinate reversal

Mateusz Loskot mateusz at loskot.net
Tue May 22 17:01:42 EDT 2007


Jesse Cleary wrote:
> Hi folks
> 
> I'm trying to convert a GML file (3.1 I think)

OGR GML is mostly compatible with GML 2, but there are some of GML 3
features supported.

> to a shapefile using
> ogr2ogr (GDAL 1.3.2.0).  The conversion works and the attributes
> translate nicely, but the destination file's point coordinates are
> reversed from the source file.  The source GML file uses the following
> nomenclature:
> 
>                <gml:Point>
>                    <gml:pos>lat lon</gml:pos>
>                </gml:Point>
> 
> OGR seems to expect the order to be lon then lat.

Yes, OGR maps lat/lon to X/Y, what results in reversed order
becasue X is usually lon and Y is lat.

In GML, standard cartographic order is used, latitude/longitude.
If dealing projected coordinates system, the easting-northing order is
used. So, there are many possible standards, and OGR ignores them in
some way, reading first coordiante as X and second as Y,
as in cartesian coordinate system.

Frank,

May be GML driver should be more specific and less ignorant here,
and parse coordiantes in  lat-lon order ?

> Is there any way to
> tell ogr2ogr how to reverse the expected order of coordinates inside
> these tags?

No, there isn't.

> Or maybe my source file doesn't meet the GML spec and
> should be changed to lon then lat?  Thanks...

I believe your GML file is correct according GML.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list