[gdal-dev] Coordinate transformation of geometries between CRSs with different axis ordering (C API)

Florian Katerndahl florian at katerndahl.com
Wed Apr 1 07:04:36 PDT 2026


Dear all,

I'm currently working on a small program which allows users to specify 
vector inputs in different coordinates systems and that potentially 
"normalizes" them to EPSG:4326 internally to process them further. Maybe 
I'm too inexperienced and there's an easy solution but I got hung up on 
the coordinate transformation when the input CRS has a different axis 
ordering compared to the output CRS using GDAL's/OGR's C API.

For example, transforming between EPSG:5556 and EPSG:4326, GDAL outputs 
a warning (forwarded from proj?) that the output's latitude is invalid. 
Setting the axis ordering of the target CRS to 
`OAMS_TRADITIONAL_GIS_ORDER` fixes this and results in correctly located 
polygons. My question is now: Is it sufficient/correct to compare the 
axis ordering of the input and output coordinate systems and set above 
mentioned flag (or a custom mapping when neither "x"/"y" are the first 
two axis) in case they differ?


Kind regards and many thanks in advance,

Florian Katerndahl



More information about the gdal-dev mailing list