Re: [gdal-dev] Difference between ogr2ogr and Python reprojection

2023-03-14 Thread Scott
While I don't have a direct answer to your question I might ask, why use 20 lines of python code when 1 line of ogr2ogr gives the correct result? On 3/14/23 11:15, Dion-Degodez,Nicolas (ECCC) wrote: _Context_ We are trying to reproject a GeoJSON polygon to EPSG:4326. In some cases, depending

Re: [gdal-dev] Difference between ogr2ogr and Python reprojection

2023-03-14 Thread Even Rouault
Nicolas, ogr2ogr uses the OGRGeometryFactory::transformWithOptions() method that has logic to deal with poles, antimerdian, etc. whereas OGRGeometry::transform() does basic point-to-point reprojection You can achieve what you want by using the ogr.GeomTransformer(ct) method that returns a og

[gdal-dev] Difference between ogr2ogr and Python reprojection

2023-03-14 Thread Dion-Degodez,Nicolas (ECCC)
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 g