New test-case with minimum allowed polygons  test_polys-3_3996.csv :
WKT,ID
"POLYGON ((-1000000 0,0 1000000,0 0,-1000000 0))","1"
"POLYGON ((0 0,0 1000000,1000000 0,0 0))","2"
"POLYGON ((-1000000 0,0 0,0 -1000000,-1000000 0))","3"
"POLYGON ((0 -1000000,0 0,1000000 0,0 -1000000))","4"
 
gdal vector pipeline read test_polys-3_3996.csv --oo KEEP_GEOM_COLUMNS=NO ! 
reproject -s EPSG:3996 -d EPSG:4326 ! write -f CSV --lco GEOMETRY=AS_WKT 
test_polys-3_3996-4326.csv
 
Resulting  test_polys-3_3996-4326.csv :
WKT,ID
"POLYGON ((-90 80.910166664287,180.0 80.910166664287,180 90,-90 90,-90 
80.910166664287))","1"
"POLYGON ((90.0 80.910166664287,180 90,180.0 80.9101666644451,90.0 
80.910166664287))","2"
"POLYGON ((-90 80.910166664287,-90 90,0 90,0.0 80.910166664287,-90 
80.910166664287))","3"
"POLYGON ((0.0 80.910166664287,0 90,90 90,90.0 80.910166664287,0.0 
80.910166664287))","4"
 
Polygons ID 1 and ID 2 are obviously reprojected incorrectly.
 
Directly reprojected coordinates should look like this ( 
test_polys-3_3996-4326-direct.csv ):
WKT,ID
"POLYGON ((-90 80.9101666642873,-180 80.9101666642873,0 90,-90 
80.9101666642873))","1"
"POLYGON ((0 90,180 80.9101666642873,90 80.9101666642873,0 90))","2"
"POLYGON ((-90 80.9101666642873,0 90,0 80.9101666642873,-90 
80.9101666642873))","3"
"POLYGON ((0 80.9101666642873,0 90,90 80.9101666642873,0 80.9101666642873))","4"
 
Additional vertices can be added to make the shape more regular ( 
test_polys-3_3996-4326-advanced.csv ):
WKT,ID
"POLYGON ((-90 80.910166664287,-180 80.910166664287,-180 90,-90 90,-90 
80.910166664287))","1"
"POLYGON ((90 90,180 90,180 80.9101666644451,90 80.910166664287,90 90))","2"
"POLYGON ((-90 80.910166664287,-90 90,0 90,0 80.910166664287,-90 
80.910166664287))","3"
"POLYGON ((0 80.910166664287,0 90,90 90,90 80.910166664287,0 
80.910166664287))","4"
>Friday, October 24, 2025 10:42 PM +03:00 from Andrey VI < [email protected] >:
> 
>Actually
>> Polygon ID 2 should be
>> POLYGON ((135 77.17079836679849336, 90 80.91016666428700432,  90 90 , 180 
>>90, 180 80.91016666428700432, 135 77.17079836679849336))
>is  incorrect because the first point of this polygon should be  0 90 . So I 
>think that reprojected geometries should be as in  
>test_polys-2_3996-4326-proper.csv (attached) :
>WKT,ID
>"POLYGON ((-90 80.910166664287,-135 77.1707983667985,-180 80.910166664287,-180 
>90,0 90,-90 80.910166664287))","1"
>"POLYGON ((0 90,180 90,180 80.910166664287,135 77.1707983667985,90 
>80.910166664287,0 90))","2"
>"POLYGON ((-45 77.1707983667985,-90 80.910166664287,0 90,0 80.910166664287,-45 
>77.1707983667985))","3"
>"POLYGON ((0 80.910166664287,0 90,90 80.910166664287,45 77.1707983667985,0 
>80.910166664287))","4"
>>Friday, October 24, 2025 7:32 PM +03:00 from Andrey VI via gdal-dev < 
>>[email protected] >:
>> 
>>Thank you, Even.
>> 
>>I think that I found an issue with re-projection.
>>4 polygons in EPSG:3996 as test_polys-2_3996.csv:
>>WKT,ID
>>"POLYGON ((-1000000 0,-1000000 1000000,0 1000000,0 0,-1000000 0))",1
>>"POLYGON ((0 0,0 1000000,1000000 1000000,1000000 0,0 0))",2
>>"POLYGON ((-1000000 -1000000,-1000000 0,0 0,0 -1000000,-1000000 -1000000))",3
>>"POLYGON ((0 -1000000,0 0,1000000 0,1000000 -1000000,0 -1000000))",4
>> 
>>gdal vector pipeline read test_polys-2_3996.csv --oo KEEP_GEOM_COLUMNS=NO ! 
>>reproject -s EPSG:3996 -d EPSG:4326 ! write -f CSV --lco GEOMETRY=AS_WKT 
>>test_polys-2_3996-4326.csv
>> 
>>Resulting  test_polys-2_3996-4326.csv :
>>WKT,ID
>>"POLYGON ((-90 80.910166664287,-135 77.1707983667985,180.0 
>>80.910166664287,180 90,-90 90,-90 80.910166664287))","1"
>>"POLYGON ((135.0 77.1707983667985,90.0 80.910166664287,180 90,180.0 
>>80.910166664287,135.0 77.1707983667985))","2"
>>"POLYGON ((-45 77.1707983667985,-90 80.910166664287,-90 90,0 90,0.0 
>>80.910166664287,-45 77.1707983667985))","3"
>>"POLYGON ((0.0 80.910166664287,0 90,90 90,90.0 80.910166664287,45.0 
>>77.1707983667985,0.0 80.910166664287))","4"
>> 
>>It looks like polygons with IDs 1 and 2 were reprojected incorrectly.
>>Polygon ID 1 should be
>>POLYGON ((-90 80.91016666428700432, -135 77.17079836679849336,  -180 
>>80.91016666428700432,  -180 90, -90 90, -90 80.91016666428700432))
>>Polygon ID 2 should be
>>POLYGON ((135 77.17079836679849336, 90 80.91016666428700432,  90 90 , 180 90, 
>>180 80.91016666428700432, 135 77.17079836679849336))
>> 
>> 
>>>Thursday, October 23, 2025 1:39 PM +03:00 from Even Rouault < 
>>>[email protected] >:
>>> 
>>>Andrey,
>>>
>>>| With ogr2ogr re-projection now works as expected, but when using gdal
>>>vector pipeline (reproject -d EPSG:4326) it works without any changes.
>>>Is this correct?
>>>
>>>Actually an extra fix for vector reproject was needed:
>>>https://github.com/OSGeo/gdal/pull/13275
>>>
>>>Even
>>>
>>>
>>>--
>>>http://www.spatialys.com
>>>My software is free, but my time generally not. 
>> 
>>--
>>Andrey
>> 
>>_______________________________________________
>>gdal-dev mailing list
>>[email protected]
>>https://lists.osgeo.org/mailman/listinfo/gdal-dev 
> 
>--
>Andrey
--
Andrey
WKT,ID
"POLYGON ((-1000000 0,0 1000000,0 0,-1000000 0))","1"
"POLYGON ((0 0,0 1000000,1000000 0,0 0))","2"
"POLYGON ((-1000000 0,0 0,0 -1000000,-1000000 0))","3"
"POLYGON ((0 -1000000,0 0,1000000 0,0 -1000000))","4"
WKT,ID
"POLYGON ((-90 80.910166664287,180.0 80.910166664287,180 90,-90 90,-90 80.910166664287))","1"
"POLYGON ((90.0 80.910166664287,180 90,180.0 80.9101666644451,90.0 80.910166664287))","2"
"POLYGON ((-90 80.910166664287,-90 90,0 90,0.0 80.910166664287,-90 80.910166664287))","3"
"POLYGON ((0.0 80.910166664287,0 90,90 90,90.0 80.910166664287,0.0 80.910166664287))","4"
WKT,ID
"POLYGON ((-90 80.9101666642873,-180 80.9101666642873,0 90,-90 80.9101666642873))","1"
"POLYGON ((0 90,180 80.9101666642873,90 80.9101666642873,0 90))","2"
"POLYGON ((-90 80.9101666642873,0 90,0 80.9101666642873,-90 80.9101666642873))","3"
"POLYGON ((0 80.9101666642873,0 90,90 80.9101666642873,0 80.9101666642873))","4"
WKT,ID
"POLYGON ((-90 80.910166664287,-180 80.910166664287,-180 90,-90 90,-90 80.910166664287))","1"
"POLYGON ((90 90,180 90,180 80.9101666644451,90 80.910166664287,90 90))","2"
"POLYGON ((-90 80.910166664287,-90 90,0 90,0 80.910166664287,-90 80.910166664287))","3"
"POLYGON ((0 80.910166664287,0 90,90 90,90 80.910166664287,0 80.910166664287))","4"
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to