[gdal-dev] Re: Ogr2ogr -flip_coordinates
Jukka Rahkonen
jukka.rahkonen at mmmtike.fi
Sat Nov 5 05:48:28 EDT 2011
Andrew Brooks <arb <at> sat.dundee.ac.uk> writes:
>
>
> On 3 November 2011 20:38, Jukka Rahkonen wrote:
>
>
>
> Thereafter I will try if I can just turn the coordinates from these
> <gml:lowerCorner>6605838.360 61685.735</gml:lowerCorner>
> into these
> <gml:lowerCorner>61685.735 6605838.360</gml:lowerCorner>
> in the whole xml file with awk or something else as horrible.
>
> Maybe something like this?
>
> perl -ne 's,<gml:lowerCorner>([-+e\.0-9]+)
+([-+e\.0-9]+)</gml:lowerCorner>,
<gml:lowerCorner>\2 \1</gml:lowerCorner>,;print;'
Thanks for the suggestion. I did not try it, though, because I already had three
solutions. The first and best was that data provider corrected the data. I still
continued a bit further and found that PostGIS 2.0 has a function
ST_FlipCoordinates for this purpose, and Spatialite has similar function
SwapCoordinates. I'd guess that it would be a bit harder to handle a list of
coordinates in linestrings and polygons.
-Jukka Rahkonen-
More information about the gdal-dev
mailing list