[gdal-dev] GeoTiff - image coordinates and world file

Even Rouault even.rouault at mines-paris.org
Thu Oct 22 15:03:47 EDT 2009


Selon Aleksey Naumov <anaumov at gmail.com>:

With GDALSetGeoTransform() API, you can also modify in-place the geotransform
matrix of an existing geotiff. The geotransform can be obtained from the world
file with GDALLoadWorldFile() for example.

> Even,
>
> Thank you for explaining about tags in GeoTiff, I did not realize that have
> priority over the world file. Your solution of using PROFILE=BASELINE works,
> however it also truncates some useful tags, such as the coordinate system. I
> could put the coordinate system back with -a_srs, but is there a way to
> selectively delete certain tags froma GeoTiff (I suppose while re-creating
> it, not in-place)?
>
> Or, is there a way to at least see the tags? Looked briefly at "tiffinfo"
> and noticed output "Tag 33922:
> 0.000000,0.000000,0.000000,5051999.800000,5052000.000000,0.000000" which
> looks to me like it's citing the origin coordinates. However, did not
> investigate further so far...
>
> Best regards,
> Aleksey
>
> On Thu, Oct 22, 2009 at 2:02 PM, Even Rouault
> <even.rouault at mines-paris.org>wrote:
>
> > Selon Aleksey Naumov <anaumov at gmail.com>:
> >
> > GDAL GeoTIFF driver always use the GeoTIFF tag when it is found. Worldfiles
> > are
> > only used when no GeoTIFF tag exists.
> >
> > One way of achieving what you want to do is to produce a clone of your
> > original
> > GeoTIFF without the geotiff tag by using the PROFILE=BASELINE creation
> > option.
> >
> > For example :
> > gdal_translate 1km177310505102008GROUPEALTA.tif
> > 1km177310505102008GROUPEALTA_nogeotifftag.tif -co PROFILE=BASELINE
> >
> > and then rename your worldfile to
> > 1km177310505102008GROUPEALTA_nogeotifftag.wld
> >
> > > HI all,
> > >
> > > I am trying to understand how coordinate information is stored in a
> > GeoTiff
> > > file, specifically the origin (UL corner) of the image. I have a few
> > images
> > > which clearly have wrong origins, so they do not display correctly. Both
> > > ArcGIS and GDAL report incorrect origins.
> > >
> > > Initially I thought that the world files for the images were at fault,
> > > however, they look totally fine. Here is an example -- notice really
> > large
> > > X-coord of origin as reported by gdalinfo:
> > > > gdalinfo 1km177310505102008GROUPEALTA.tif
> > > Driver: GTiff/GeoTIFF
> > > Files: 1km177310505102008GROUPEALTA.tif
> > >        1km177310505102008GROUPEALTA.tfw
> > > Size is 5000, 5000
> > > Coordinate System is:
> > > PROJCS["UTM Zone 17N",
> > >     GEOGCS["NAD83_CSRS_1",
> > >         DATUM["NAD83_CSRS_1",
> > >             SPHEROID["GRS 1980",6378137,298.2572220960423]],
> > >         PRIMEM["Greenwich",0],
> > >         UNIT["degree",0.0174532925199433]],
> > >     PROJECTION["Transverse_Mercator"],
> > >     PARAMETER["latitude_of_origin",0],
> > >     PARAMETER["central_meridian",-81],
> > >     PARAMETER["scale_factor",0.9996],
> > >     PARAMETER["false_easting",500000],
> > >     PARAMETER["false_northing",0],
> > >     UNIT["metre",1,
> > >         AUTHORITY["EPSG","9001"]]]
> > > Origin = (5051999.800000000700000,5052000.000000000000000)
> > > Pixel Size = (0.200000000000000,-0.200000000000000)
> > > Metadata:
> > >   TIFFTAG_SOFTWARE=Adobe Photoshop CS2 Windows
> > >   TIFFTAG_DATETIME=2008:12:30 16:08:24
> > >   TIFFTAG_XRESOLUTION=72
> > >   TIFFTAG_YRESOLUTION=72
> > >   TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> > >   AREA_OR_POINT=Area
> > > Image Structure Metadata:
> > >   INTERLEAVE=PIXEL
> > > Corner Coordinates:
> > > Upper Left  ( 5051999.800, 5052000.000) ( 34d52'42.64"W, 34d45'16.48"N)
> > > Lower Left  ( 5051999.800, 5051000.000) ( 34d52'48.38"W, 34d44'52.51"N)
> > > Upper Right ( 5052999.800, 5052000.000) ( 34d52'28.05"W, 34d45'5.78"N)
> > > Lower Right ( 5052999.800, 5051000.000) ( 34d52'33.77"W, 34d44'41.81"N)
> > > Center      ( 5052499.800, 5051500.000) ( 34d52'38.21"W, 34d44'59.14"N)
> > > Band 1 Block=5000x1 Type=Byte, ColorInterp=Red
> > > Band 2 Block=5000x1 Type=Byte, ColorInterp=Green
> > > Band 3 Block=5000x1 Type=Byte, ColorInterp=Blue
> > >
> > > The world file looks fine to me, and it has correct origin info
> > (X-coord):
> > > > type 1km177310505102008GROUPEALTA.tfw
> > > 0.200000
> > > 0.000000
> > > 0.000000
> > > -0.200000
> > > 731000.100000
> > > 5051999.900000
> > >
> > > Even if I rename the TFW file, gdalinfo still reports the same incorrect
> > > origin, so it must be stored in a GeoTiff tag, I guess? If so, how do I
> > > override and correct this info on an image? Also, does a world file not
> > have
> > > a higher priority than a built-in tag value?
> > >
> > > Thank you,
> > > Aleksey
> > >
> >
> >
> >
>




More information about the gdal-dev mailing list