Hi,

I have some images with wrong metadata. They are tagged as pixel-is-area images 
and listgeo shows the tag
GTRasterTypeGeoKey (Short,1): RasterPixelIsArea

Actually geotiffs are measurements and they should use RasterPixelIsPoint and 
images should be shifted be half a pixel on a map.

I was thinking that I can make a clever fix with gdal_edit so I made a copy of 
"area.tif" as "point.tif" and then I edited it

gdal_edit -mo AREA_OR_POINT=Point point.tif

The key gets edited into RasterPixelIsPoint just as I wished. However, the 
georeferencing that is stored into tag 33922 gets edited by the same.
Before edit:
ModelTiepointTag (2,3):
         0                 0                 0
         115               33                0
      ModelPixelScaleTag (1,3):
         0.1               0.1               0

After edit:
Tagged_Information:
      ModelTiepointTag (2,3):
         0                 0                 0
         115.05            32.95             0
      ModelPixelScaleTag (1,3):
         0.1               0.1               0

Because the ModelTiepoint gets shifted by half a pixel it compensates the shift 
caused by image-is-area vs. image-is-point and the image footprint and pixels 
stay exactly where they used to be. I know I can use gdal_edit again with 
-a_ullr ulx uly lrx lry for shifting the image but I wonder if there happens to 
be some trick for just changing raster type into pixel-is-point without 
touching the tiepoint. Option "swap PixelIsPoint/Area" in gdal_edit would be 
fine for me if the current behavior with -mo AREA_OR_POINT=Point feels correct.

-Jukka Rahkonen-









_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to