[gdal-dev] Difference between ogr2ogr and Python reprojection

Dion-Degodez,Nicolas (ECCC) Nicolas.Dion-Degodez at ec.gc.ca
Tue Mar 14 11:15:14 PDT 2023


Context
We are trying to reproject a GeoJSON polygon to EPSG:4326.
In some cases, depending on whether we use the ogr2ogr command line or the equivalent in python, the resulting polygon is different.
In those situations, the command line gives us the appropriate polygon, whereas the python code gives us a distorted polygon.

Question
Any idea why there is a difference between the command line and the python results? Is there a mistake in our interpretation of the code/how we converted it in python?

Sample GeoJSON: https://pastebin.com/hUiVVjFv
Proj4: "+proj=stere +lat_0=90 +lat_ts=60 +lon_0=264 +x_0=0 +y_0=0 +R=6371229 +units=m +no_defs"

Command line that works: ogr2ogr -s_srs "+proj=stere +lat_0=90 +lat_ts=60 +lon_0=264 +x_0=0 +y_0=0 +R=6371229 +units=m +no_defs" -t_srs EPSG:4326 result_command_line.json geojson.json
Result: https://pasteboard.co/cTpZBRamEYv8.jpg

Python code (we would expect the same output as the command line): https://pastebin.com/QgWDBL1W
Result: https://pasteboard.co/8iSv0vbnQlHw.jpg

Thank you!
Nicolas D.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230314/d795a93e/attachment.htm>


More information about the gdal-dev mailing list