gdal icon indicating copy to clipboard operation
gdal copied to clipboard

netCDF WKT export - use WKT2 version when WKT1_GDAL is not sufficient

Open snowman2 opened this issue 2 years ago • 3 comments

Related:

  • https://github.com/OSGeo/PROJ/pull/2835

I noticed these flags to disable export to WKT: https://github.com/OSGeo/gdal/blob/514ddf589cdd9a01b527c6cf59baabf028555a5c/frmts/netcdf/netcdfdataset.cpp#L4543-L4591

I was wondering if it made sense to export to WKT2 instead of skipping the CRS WKT export?

snowman2 avatar Oct 28 '21 02:10 snowman2

I was wondering if it made sense to export to WKT2 instead of skipping the CRS WKT export?

I don't think it would help for the rotated pole method. None of the WKT that are emitted in that situation are standard. The CRS string respect the WKT formalism, but none of the projection method and projection parameter names are standard (I've tried to bring the subject to the OGC CRS SWG a few times, but nothing concrete emerged from that. To have real interoperability EPSG should typically codify them, but they don't seem to have an appetite to do that currently) , and thus only PROJ would be able to make sense of them.

rouault avatar Oct 28 '21 09:10 rouault

Thanks for the explanation. In that case, would it make sense to export as WKT2 on the spatial_ref attribute only since it is only used by GDAL?

snowman2 avatar Oct 29 '21 01:10 snowman2

In that case, would it make sense to export as WKT2 on the spatial_ref attribute only since it is only used by GDAL?

yes, maybe. But I'm wondering what older GDAL versions that don't understand for example "Pole rotation (netCDF CF convention)" would do. I guess they would use the CF parameters instead, but perhaps with some warning/error emitted. It would be interested to test that.

rouault avatar Oct 29 '21 08:10 rouault