[gdal-dev] full projection parameters in geotiff
Javier Jimenez Shaw
j1 at jimenezshaw.com
Fri Dec 20 06:48:21 PST 2024
GeoTIFF does not store any WKT inside. GDAL is converting the definition of
the CRS into the proper GeoTIFF tags.
With "tiffinfo" you can see them, for instance:
TIFF Directory at offset 0x8 (8)
Image Width: 306 Image Length: 175
Bits/Sample: 32
Sample Format: IEEE floating point
Compression Scheme: None
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Rows/Strip: 6
Planar Configuration: single image plane
Tag 33550: 0.025000,0.016667,0.000000
Tag 33922: 0.000000,0.000000,0.000000,11.687500,51.208333,0.000000
Tag 34735:
1,1,0,7,1024,0,1,2,1025,0,1,1,2048,0,1,4258,2049,34737,7,0,2054,0,1,9102,2057,34736,1,1,2059,34736,1,0
Tag 34736: 298.257222,6378137.000000
Tag 34737: ETRS89|
Any other software has to "interpret" those tiff tags. Usually using
libgeotiff (that uses PROJ), but they can do anything else.
On Fri, 20 Dec 2024 at 14:46, Kirk Waters - NOAA Federal via gdal-dev <
gdal-dev at lists.osgeo.org> wrote:
> Is there a way to tell GDAL to list the full set of projection parameters
> in a GeoTiff? As much as I like the idea that you should just need the EPSG
> code, I've run across too many software packages that either don't know the
> code or have an incorrect interpretation of the code. I've tried supplying
> the WKT (from projinfo) as the -a_srs argument, but that still only puts
> the EPSG code in the georeferencing keys.
>
> I did find that if I strip the authority code from the WKT, it will put
> all the parameters in and perhaps that's the best solution. It seems a
> shame to lose the authority code though.
>
> Here's a few bash commands to illustrate.
>
> wkt=`projinfo -o WKT2:2019 EPSG:6570 --single-line | sed 1d`
>
> gdal_create -of GTiff -ot UInt16 -burn 0 -outsize 50 50 -a_srs "$wkt"
> wkt.tif
>
> gdal_create -of GTiff -ot UInt16 -burn 0 -outsize 50 50 -a_srs EPSG:6570
> epsg.tif
>
> #strip the authority code
> wkt_noauth=`echo $wkt | perl -p -e 's/],ID\["EPSG",6570]/]/;'`
>
> gdal_create -of GTiff -ot UInt16 -burn 0 -outsize 50 50 -a_srs
> "$wkt_noauth" wkt_noauth.tif
>
> Thanks for any suggestions.
>
> Kirk Waters, PhD
> NOAA Office for Coastal Management
> Applied Sciences Program
> coast.noaa.gov/digitalcoast
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241220/e99e731f/attachment.htm>
More information about the gdal-dev
mailing list