[gdal-dev] Need some info on geotiff tags missing

Even Rouault even.rouault at mines-paris.org
Sun Aug 3 03:30:58 PDT 2014


Le dimanche 03 août 2014 12:24:29, Andrea Peri a écrit :
> thx Even for explanation.
> 
> Also I see the real important for some software is the presence of this
> section:
> 
>     Keyed_Information:
>        GTRasterTypeGeoKey (Short,1): RasterPixelIsPoint
>        End_Of_Keys.
> 
> It can have two possibl values:
> RasterPixelIsPoint or RasterPixelIsArea
> 
> Seem that without a value for GTRasterTypeGeoKey some software don't work.
> 
> Is possible configure gdal to add this values when converting a
> tif+tfw to a geotiff

Andrea,

If you try what I suggested ( adding -a_srs "LOCAL_CS[\"Unknown\"]" to 
gdal_translate command line), you will get :

$ listgeo out.tif
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      ModelTiepointTag (2,3):
		[ something ]
      ModelPixelScaleTag (1,3):
		[ something ]
      End_Of_Tags.
   Keyed_Information:
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GTCitationGeoKey (Ascii,8): "Unknown"
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      ProjLinearUnitsGeoKey (Short,1): Linear_Meter
      End_Of_Keys.
   End_Of_Geotiff.

Projection Linear Units: 9001/metre (1.000000m)

Corner Coordinates:
		[ something ]

You can control RasterPixelIsPoint or RasterPixelIsArea by adding  "-mo 
AREA_OR_POINT=Area" or  "-mo AREA_OR_POINT=Point" to the gdal_translate 
command line. The default is Area.

Even

> 
> ?
> 
> Andrea.
> 
> 2014-08-03 10:49 GMT+02:00 Even Rouault <even.rouault at mines-paris.org>:
> > Le samedi 02 août 2014 23:48:54, Andrea Peri a écrit :
> >> Hi,
> >> 
> >> I have transform many old tiff+tfw rasters using this gdal
> >> transformation:
> >> 
> >> gdal_translate -ot Byte -of GTiff -b 1 -a_nodata none -stats -co
> >> COMPRESS=NONE -co INTERLEAVE=PIXEL -co PROFILE=GDALGeoTIFF -co
> >> TILED=YES -co BLOCKXSIZE=256 -co BLOCKYSIZE=256 -co SPARSE_OK=TRUE -co
> >> TFW=NO filein.tif fileout.tif
> >> 
> >> They are wrking correctly with qgis and with mapserver for several
> >> months.
> >> 
> >> Now I need to use this geotiffs with another program.
> >> But this program say that these images are not realy GeoTiffs.
> >> 
> >> I test them using listgeos and have this result:
> >> 
> >> TIFFReadDirectory: Warning, Unknown field with tag 42112 (0xa480)
> >> 
> >> encountered. Geotiff_Information:
> >>    Version: 1
> >>    Key_Revision: 1.0
> >>    
> >>    Tagged_Information:
> >>       ModelTiepointTag (2,3):
> >>          0                0                0
> >>          559417.445637    4927786.430528   0
> >>       
> >>       ModelPixelScaleTag (1,3):
> >>          0.5              0.5              0
> >>       
> >>       End_Of_Tags.
> >>    
> >>    Keyed_Information:
> >>       End_Of_Keys.
> >>    
> >>    End_Of_Geotiff.
> >> 
> >> Some people say me that this is not a true geotiff because are missing
> >> several tags.
> >> I reported a supposed response from a real geotiff:
> >> 
> >> Geotiff_Information:
> >>     Version: 1
> >>     Key_Revision: 1.0
> >>     
> >>     Tagged_Information:
> >>        ModelTiepointTag (2,3):
> >>           0                 0                 0
> >>           673347            4298291           0
> >>        
> >>        ModelPixelScaleTag (1,3):
> >>           1                 1                 1
> >>        
> >>        End_Of_Tags.
> >>     
> >>     Keyed_Information:
> >>        GTModelTypeGeoKey (Short,1): ModelTypeProjected
> >>        GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
> >>        GTCitationGeoKey (Ascii,37): "NAIP 2012
> >> 
> >> m_3808409_sw_16_1_20120607"
> >> 
> >>        ProjectedCSTypeGeoKey (Short,1): PCS_NAD83_UTM_zone_16N
> >>        PCSCitationGeoKey (Ascii,21): "NAD83 / UTM zone 16N"
> >>        ProjLinearUnitsGeoKey (Short,1): Linear_Meter
> >>        End_Of_Keys.
> >>     
> >>     End_Of_Geotiff.
> >> 
> >> PCS = 26916 (NAD83 / UTM zone 16N)
> >> Projection = 16016 (UTM zone 16N)
> >> Projection Method: CT_TransverseMercator
> >> 
> >>     ProjNatOriginLatGeoKey: 0.000000 (  0d 0' 0.00"N)
> >>     ProjNatOriginLongGeoKey: -87.000000 ( 87d 0' 0.00"W)
> >>     ProjScaleAtNatOriginGeoKey: 0.999600
> >>     ProjFalseEastingGeoKey: 500000.000000 m
> >>     ProjFalseNorthingGeoKey: 0.000000 m
> >> 
> >> GCS: 4269/NAD83
> >> Datum: 6269/North American Datum 1983
> >> Ellipsoid: 7019/GRS 1980 (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    (  673347.000, 4298291.000)  ( 85d 0'12.06"W,
> >> 38d48'58.87"N)
> >> Lower Left    (  673347.000, 4290632.000)  ( 85d 0'18.99"W,
> >> 38d44'50.54"N)
> >> Upper Right   (  679532.000, 4298291.000)  ( 84d55'55.75"W,
> >> 38d48'54.41"N)
> >> Lower Right   (  679532.000, 4290632.000)  ( 84d56' 2.92"W,
> >> 38d44'46.10"N)
> >> Center        (  676439.500, 4294461.500)  ( 84d58' 7.43"W,
> >> 38d46'52.50"N)
> >> 
> >> -----
> >> 
> >> I'm a bit confused.
> >> Because I have produced my GeoTiffs using gdal. And if it fail to
> >> produce a real geotiff I have a trouble.
> >> 
> >> So the main question is a geotiff ith only the tags reported a real
> >> geotiff ?
> > 
> > Andrea,
> > 
> > The difference between the 2 geotiff is that the first one does not have
> > information on the spatial reference system, but only the geotransform
> > that comes from the .tfw file.
> > Skimming quickly through the GeoTIFF specification (
> > http://www.remotesensing.org/geotiff/spec/contents.html ) doesn't
> > immediately show if it is valid or not, although it would be best if
> > readers are robust to missing information.
> > If you know the SRS of the maps, you can try adding -a_srs EPSG:XXXX or
> > -a_srs wkt_string.
> > You could also try -a_srs "LOCAL_CS[\"Unknown\"]" if you don't know the
> > SRS at all. This will write a few geotiff keys to define a unknown CRS,
> > but it is not obvious that your reader will like it.
> > 
> > Even
> > 
> > --
> > Geospatial professional services
> > http://even.rouault.free.fr/services.html

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list