osmcode / osmium-tool

Command line tool for working with OpenStreetMap data based on the Osmium library.
https://osmcode.org/osmium-tool/
GNU General Public License v3.0
509 stars 107 forks source link

Osmium extract output data has shifted coordinates? #201

Closed apiszcz closed 3 years ago

apiszcz commented 3 years ago

I updated to the latest version 1.11.1 and am now a translation of coordinates for the features. The shift appears to be approximately -20 degrees in lat,lon. Is there a path to review this issue. The data is for the correct region, just shifted.

joto commented 3 years ago

Not reproducable

apiszcz commented 3 years ago

This issue is NOT osmium, sorry for the query.

ogr2poly.py is producing the coordinate output for the polygons with reversed order, osmium requires lon,lat, and ogr2poly producing lat,lon when using GDAL 3.x. Assume it was developed with GDAL 2.x, and now GDAL 3.x changes the ordering.

Required output. http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format

Starting with GDAL 3.0, the axis order mandated by the authority defining a CRS is by default honoured by the OGRCoordinateTransformation class, and always exported in WKT1. Consequently CRS created with the “EPSG:4326” or “WGS84” strings use the latitude first, longitude second axis order.

For some areas I use the following.

        if self.osgeo.__version__ >= '3.0':
            self.srcsrs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
            self.dstsrs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)