[PROJ] Correcting metadata in GeoTIFF files

Even Rouault even.rouault at spatialys.com
Mon Jan 24 12:17:06 PST 2022


Jochem,

Le 24/01/2022 à 20:09, Lesparre, Jochem via PROJ a écrit :
>
> Dear list,
>
> I'm from Netherlands Partnership Geodetic Infrastructure (NSGI). We 
> published NTv2 (.gsb) and VDatum (.gtx) grid files for the national 
> CRS of the Netherlands (RD coordinates with NAP height) in 2019. PROJ 
> converted these to GeoTIFF (.tif) in 2020 [1]. Unfortunately, some 
> wrong information was stored in the metadata of the GeoTIFF files in 
> the conversion. We are now creating new GeoTIFF files with corrected 
> metadata, using the Python scrips ntv2_to_gtiff.py [2] and 
> vertoffset_grid_to_gtiff.py [3].
>
> For most changes in the metadata this is straightforward, but there is 
> one more difficult issue:
>
> We have two variants of the horizontal transformation:
>
>   * Conventional 1-step transformation (variant 2): geographic
>     coordinates of national CRS ---[nl_nsgi_rdtrans2018.tif]---> ETRS89
>   * Better 2-step transformation (variant 1): geographic coordinates
>     of national CRS ---[nl_nsgi_rdcorr2018.tif]---> corrected
>     geographic coordinates of national CRS
>     ---[7_parameter_transformation]---> ETRS89
>
> Since there is no separate EPSG code for the corrected geographic 
> coordinates of the national CRS, we want to use the same EPSG code for 
> both corrected and uncorrected coordinates. Or will it give problems 
> when the source and target CRS of a GeoTIFF file are the same?
>
Instead of the target_crs_code metadata item, you could include a 
target_crw_wkt with a WKT2 string. That can be done through the 
ntv2_to_gtiff.py script as it can accept a WKT2 CRS string as the value 
for --target-crs.

> Next to this, I have some other questions:
>
>   * Shouldn't a GeoTIFF grid file for a vertical transformation have
>     an accuracy band like a grid for a horizontal transformation? Is
>     it possible with the Python script to create an accuracy band in
>     the GeoTIFF from a VDatum grid file?
>
You could possibly add with GDAL standard tools (gdal_translate, etc) a 
band with the accuracy and a description of "geoid_undulation_accuracy" 
(you may need to go through a VRT to manually add the Units to the 
band). The validate_vertical_offset_geographic_to_vertical() method of 
the check_gtiff_grid.py script would likely have to be updated so that 
it doesn't emit an information message about the new band not being 
recognized. And the spec at 
https://proj.org/specifications/geodetictiffgrids.html as well


>   * Can I add a recommended_interpolation_method with the Python scripts?
>
Not currently.  Either enhance them or add the metadata item manually 
through GDAL tools (gdal_translate -mo 
recommended_interpolation_method=foo in.tif out.tif -co COMPRESS=DEFLATE 
-co INTERLEAVE=BAND -co PREDICTOR=3). Note that PROJ itself will ignore 
that item and always apply bilinear interpolation.
>
>   * How should I supply the corrected GeoTIFF files to PROJ?
>
Pull request against https://github.com/OSGeo/PROJ-data 
<https://github.com/OSGeo/PROJ-data/tree/master/nl_nsgi>
>
>   * Is it necessary for PROJ to use new files names to distinguish
>     them from the old version with incorrect metadata?
>
No
>
>  *
>
> Regards, Jochem
>
> [1] https://github.com/OSGeo/PROJ-data/tree/master/nl_nsgi 
> <https://github.com/OSGeo/PROJ-data/tree/master/nl_nsgi>
>
> [2] 
> https://github.com/OSGeo/PROJ-data/blob/master/grid_tools/ntv2_to_gtiff.py 
> <https://github.com/OSGeo/PROJ-data/blob/master/grid_tools/ntv2_to_gtiff.py>
>
> [3] 
> https://github.com/OSGeo/PROJ-data/blob/master/grid_tools/vertoffset_grid_to_gtiff.py 
> <https://github.com/OSGeo/PROJ-data/blob/master/grid_tools/vertoffset_grid_to_gtiff.py>
>
> **
>
> J. Lesparre
>
> Netherlands Partnership Geodetic Infrastructure (NSGI.nl)
>
>
>
> Disclaimer:
> De inhoud van deze e-mail is vertrouwelijk en uitsluitend bestemd voor 
> de geadresseerde(n).
> Gebruik, openbaarmaking, vermenigvuldiging, verspreiding en/of 
> verstrekking van deze informatie aan derden is niet toegestaan.
> Op al onze producten en diensten zijn onze algemene 
> leveringsvoorwaarden van toepassing
> [https://www.kadaster.nl/algemene-leveringsvoorwaarden].
>
> Disclaimer:
> This email and any files transmitted with it are confidential and 
> intended solely for the use of the individual or entity to whom they 
> are addressed.
> If you are not the intended recipient, you are notified that 
> disclosing, copying, distributing or taking any action in reliance on 
> the contents of this information is strictly prohibited.
> Our general terms and conditions of delivery apply to all our products 
> and services
> [https://www.kadaster.com/general-terms-and-conditions].
>
> _______________________________________________
> PROJ mailing list
> PROJ at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/proj

-- 
http://www.spatialys.com
My software is free, but my time generally not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20220124/57f8f6c1/attachment.html>


More information about the PROJ mailing list