[gdal-dev] full projection parameters in geotiff

Kirk Waters - NOAA Federal kirk.waters at noaa.gov
Fri Dec 20 06:59:38 PST 2024


Javier,
I believe that example doesn't have all the parameters. Using 'listgeo'
(easier to see what the tags are), I see this for the Geotiff information
if I use the EPSG code to set the SRS:
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GTCitationGeoKey (Ascii,34): "NAD83(2011) / South Carolina (ft)"
      GeogCitationGeoKey (Ascii,12): "NAD83(2011)"
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      ProjectedCSTypeGeoKey (Short,1): Code-6570 (NAD83(2011) / South
Carolina (ft))
      ProjLinearUnitsGeoKey (Short,1): Linear_Foot
      End_Of_Keys.
   End_Of_Geotiff.

If instead, I use the WKT after stripping out the authority code, I see
this:
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GTCitationGeoKey (Ascii,34): "NAD83(2011) / South Carolina (ft)"
      GeographicTypeGeoKey (Short,1): Code-6318 (NAD83(2011))
      GeogCitationGeoKey (Ascii,12): "NAD83(2011)"
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      GeogSemiMajorAxisGeoKey (Double,1): 6378137
      GeogInvFlatteningGeoKey (Double,1): 298.257222101
      Unknown-3059 (Short,1): Unknown-1
      ProjectedCSTypeGeoKey (Short,1): User-Defined
      ProjectionGeoKey (Short,1): User-Defined
      ProjCoordTransGeoKey (Short,1): CT_LambertConfConic_2SP
      ProjLinearUnitsGeoKey (Short,1): Linear_Foot
      ProjStdParallel1GeoKey (Double,1): 34.8333333333333
      ProjStdParallel2GeoKey (Double,1): 32.5
      ProjFalseOriginLongGeoKey (Double,1): -81
      ProjFalseOriginLatGeoKey (Double,1): 31.8333333333333
      ProjFalseOriginEastingGeoKey (Double,1): 2000000
      ProjFalseOriginNorthingGeoKey (Double,1): 0
      End_Of_Keys.
   End_Of_Geotiff.

Using tiffinfo shows the difference too.
Using EPSG code or full WKT has tags:
Tag 34735:
1,1,0,7,1024,0,1,1,1025,0,1,1,1026,34737,34,0,2049,34737,12,34,2054,0,1,9102,3072,0,1,6570,3076,0,1,9002
  Tag 34737: NAD83(2011) / South Carolina (ft)|NAD83(2011)|

Using WKT with authority stripped has tags:
  Tag 34735:
1,1,0,19,1024,0,1,1,1025,0,1,1,1026,34737,34,0,2048,0,1,6318,2049,34737,12,34,2054,0,1,9102,2057,34736,1,7,2059,34736,1,6,3059,0,1,1,3072,0,1,32767,3074,0,1,32767,3075,0,1,8,3076,0,1,9002,3078,34736,1,2,3079,34736,1,3,3084,34736,1,1,3085,34736,1,0,3086,34736,1,4,3087,34736,1,5
  Tag 34736:
31.833333,-81.000000,34.833333,32.500000,2000000.000000,0.000000,298.257222,6378137.000000
  Tag 34737: NAD83(2011) / South Carolina (ft)|NAD83(2011)|

Kirk


On Fri, Dec 20, 2024 at 9:48 AM Javier Jimenez Shaw <j1 at jimenezshaw.com>
wrote:

> 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/22a1163f/attachment-0001.htm>


More information about the gdal-dev mailing list