9

I'm trying to understand GeoTIFF info, but not getting far. For instance, using listgeo with one file I can get this output:

Geotiff_Information:
  Version: 1
  Key_Revision: 1.0
  Tagged_Information:
    ModelTiepointTag (2,3):
       0                0                0                
       617632.387       5169109.1        0                
    ModelPixelScaleTag (1,3):
       0.597164283      0.597164283      1                
  End_Of_Tags.
  Keyed_Information:
    GTModelTypeGeoKey (Short,1): ModelTypeProjected
    GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
    GeographicTypeGeoKey (Short,1): Unknown-4167
    GeogAngularUnitsGeoKey (Short,1): Angular_Degree
    GeogSemiMajorAxisGeoKey (Double,1): 6378137          
    GeogSemiMinorAxisGeoKey (Double,1): 6356752.31       
    GeogInvFlatteningGeoKey (Double,1): 298.257222       
    ProjectedCSTypeGeoKey (Short,1): Unknown-2134
    ProjLinearUnitsGeoKey (Short,1): Linear_Meter
  End_Of_Keys.
End_Of_Geotiff.

PCS = 2134 (name unknown)
GCS: 4167/(unknown)
Projection Linear Units: 9001/metre (1.000000m)

Corner Coordinates:
Upper Left    (  617632.387, 5169109.098)
Lower Left    (  617632.387, 5164958.209)
Upper Right   (  621797.608, 5169109.098)
Lower Right   (  621797.608, 5164958.209)
Center        (  619714.997, 5167033.654)

Now, I know that those corner coords are UTM, but does anything in the other tags tell me that?

Similarly, with a different projection, the same area gives me:

Geotiff_Information:
Version: 1
Key_Revision: 1.0
Tagged_Information:
   ModelTiepointTag (2,3):
      0                0                0                
      19198032.5       -5377596.2       0                
   ModelPixelScaleTag (1,3):
      0.597164283      0.597164283      1                
   End_Of_Tags.
  Keyed_Information:
    GTModelTypeGeoKey (Short,1): ModelTypeProjected
    GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
    GeographicTypeGeoKey (Short,1): GCS_WGS_84
    GeogAngularUnitsGeoKey (Short,1): Angular_Degree
    GeogSemiMajorAxisGeoKey (Double,1): 6378137          
    GeogSemiMinorAxisGeoKey (Double,1): 6356752.31       
    GeogInvFlatteningGeoKey (Double,1): 298.257224           
    ProjectedCSTypeGeoKey (Short,1): Unknown-3395    
    ProjCoordTransGeoKey (Short,1): CT_Mercator
    ProjLinearUnitsGeoKey (Short,1): Linear_Meter
    ProjStdParallel1GeoKey (Double,1): 0                
    ProjStdParallel2GeoKey (Double,1): 0                
    ProjNatOriginLongGeoKey (Double,1): 0                
    ProjNatOriginLatGeoKey (Double,1): 0                
    ProjFalseEastingGeoKey (Double,1): 0                
    ProjFalseNorthingGeoKey (Double,1): 0                
    ProjFalseOriginLongGeoKey (Double,1): 0                
    ProjFalseOriginLatGeoKey (Double,1): 0                
    ProjFalseOriginEastingGeoKey (Double,1): 0                
    ProjFalseOriginNorthingGeoKey (Double,1): 0                
    ProjCenterLongGeoKey (Double,1): 0                
    ProjCenterLatGeoKey (Double,1): 0                
    ProjCenterEastingGeoKey (Double,1): 0                
    ProjCenterNorthingGeoKey (Double,1): 0                
    ProjScaleAtNatOriginGeoKey (Double,1): 1                
    ProjAzimuthAngleGeoKey (Double,1): 0                
    ProjStraightVertPoleLongGeoKey (Double,1): 0                
  End_Of_Keys.
End_Of_Geotiff.

PCS = 3395 (name unknown)
Projection Method: CT_Mercator
   ProjNatOriginLatGeoKey: 0.000000 (  0d 0' 0.00"N)
   ProjNatOriginLongGeoKey: 0.000000 (  0d 0' 0.00"E)
   ProjScaleAtNatOriginGeoKey: 1.000000
   ProjFalseEastingGeoKey: 0.000000 m
   ProjFalseNorthingGeoKey: 0.000000 m
GCS: 4326/WGS 84
Datum: 6326/World Geodetic System 1984
Ellipsoid: 7030/WGS 84 (6378137.00,6356752.31)
Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
Projection Linear Units: 9001/metre (1.000000m)

Corner Coordinates:
Upper Left    (19198032.501,-5377596.196)
Lower Left    (19198032.501,-5383223.872)
Upper Right   (19203679.883,-5377596.196)
Lower Right   (19203679.883,-5383223.872)
Center        (19200856.192,-5380410.034)

The tags 'tell me' this is WGS84 - but what are the coords? I'm trying to reliably extract positional data, but can't because I don't understand the what the output is telling me?

3
  • Also try gdalinfo, which I find more useful and generic.
    – Mike T
    Commented Jun 7, 2013 at 0:00
  • Yeah, I've used GDAL too - but I'm looking to integrate this with my app, so I'd leaning towards libgeotiff if I can - gdal has a comparatively huge overhead!
    – Kyudos
    Commented Jun 7, 2013 at 2:25
  • Yup, libgeotiff is much leaner
    – Mike T
    Commented Jun 7, 2013 at 2:33

2 Answers 2

8

Here's an extremely dense but useful explanation of the GeoTIFF specification: http://duff.ess.washington.edu/data/raster/drg/docs/geotiff.txt

The PCS tag is the EPSG number of the projection coordinate system. GCS is the EPSG number of the geographic coordinate system. So your first file is in UTM 59S, with linear unit of meters. The second file is World Mercator, also with linear unit of meters. The cell size of both is ~0.597m. GeogAngularUnitsGeoKey is the unit of the GCS, and ProjLinearUnitsGeoKey is the unit of the PCS.

Hopefully that will get you started.

3
  • 4167 is NZGD2000. You can look up EPSG numbers at epsg-registry.org
    – mkennedy
    Commented Jun 6, 2013 at 16:52
  • That is useful, thanks. My aim is to transform the coordinates to WGS84/UTM (automatically in code). I hope there is a generic way to do this rather than checking against a huge list of EPSG codes!
    – Kyudos
    Commented Jun 6, 2013 at 21:22
  • 2
    You can also borrow two files from GDAL_DATA: pcs.csv and gcs.csv. These are full of EPSG codes, described for the PCS and GCS tags described above.
    – Mike T
    Commented Jun 7, 2013 at 2:38
0

It seems to me your question has two parts--1) what do the tags tell you about the coordinate system, and an implied 2) how to extract positional data based on the image's coordinate system.

TAGS: L_Holcombe is right, in that the PCS (projected coordinate system) holds an EPSG code for the coordinate system that is supposed to describe the image. I prefer to research coordinate systems at spatialreference.org because I can drop the EPSG code right in the url and get what I want; for example: http://spatialreference.org/ref/epsg/2134/ogcwkt/

POSITIONAL DATA: As for extracting positional data (X/Y == cell value), if all of your imagery is projected, and if you already have or at least don't mind making world files for your imagery, then the equation to get from a known position x' and y' (a.k.a. Easting/Northing) to the raster cell x and y holding that value is this:

enter image description here

(Image from Wikipedia's World File article.)

—check the article to know what arguments A-F represent

CAVEAT: I wonder, though, if your positional data is in Lat/Long, or perhaps coordinate systems other than your various projected images? If this is the case, you'll need a programmatic way to first translate between the coordinate system of your sample points to the coordinate system of your imagery before you'll have the correct Easting/Northing values to plug into the equation above. Depending on the programming language your using, you might be able to find a Proj4 implementation to do this work for you, which I recommend because the routines to translate between coordinate systems can be pretty intimidating. Just Google "Proj4 %LANGUAGE%", etc. At that point, the challenge of gleaning cells values from your GeoTiffs via your programming language of choice will involve interpreting the TIFF spec (see also tag details) and interrogating the raster values by iterating through bytes and bits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.