[gdal-dev] How to change wrong PixelIsArea into correct PixelIsPoint?

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Tue Dec 17 08:51:51 PST 2019


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-









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20191217/25ba03b9/attachment.html>


More information about the gdal-dev mailing list