[gdal-dev] VRT file with cutline behaves strangely with tiff with overviews

Paul Meems bontepaarden at gmail.com
Sat Jul 1 10:16:48 PDT 2017


I'm using GDAL v2.1.3

I have a tiff file with this info:
Driver: GTiff/GeoTIFF
Files: Chlorofyl-index.tif
       Chlorofyl-index.tif.aux.xml
Size is 5140, 6065
Coordinate System is:
PROJCS["WGS 84 / UTM zone 32N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32632"]]
Origin = (360810.191610000040000,5860662.620930000200000)
Pixel Size = (0.125010000000000,-0.125010000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  360810.192, 5860662.621) (  6d55'54.04"E, 52d52'39.50"N)
Lower Left  (  360810.192, 5859904.435) (  6d55'55.21"E, 52d52'14.98"N)
Upper Right (  361452.743, 5860662.621) (  6d56'28.39"E, 52d52'40.10"N)
Lower Right (  361452.743, 5859904.435) (  6d56'29.55"E, 52d52'15.58"N)
Center      (  361131.467, 5860283.528) (  6d56'11.80"E, 52d52'27.54"N)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
  Min=-0.177 Max=33.644
  Minimum=-0.177, Maximum=33.644, Mean=18.605, StdDev=7.894
  NoData Value=-10000
  Metadata:
    STATISTICS_MAXIMUM=33.644180297852
    STATISTICS_MEAN=18.604999564386
    STATISTICS_MINIMUM=-0.17713606357574
    STATISTICS_STDDEV=7.8939827089249

I cut this file with a border shapefile and save it to a VRT file using
this command:
gdalwarp -of VRT -cutline border.shp -crop_to_cutline -dstnodata 0
-overwrite Chlorofyl-index.tif Chlorofyl-index-clipped.vrt

I open this vrt-file in MapWindow5 and in QGis and it looks as expected.

I now add external overviews to the tiff file using:
gdaladdo -ro -r nearest Chlorofyl-index.tif 2 4 8 16

I reopen the vrt file and both MapWindow5 as QGis show a complete different
part of the tiff.
In QGis it is much smaller and outside the original border and with MW5 it
is bigger and less high than the border. Either way they are wrong.

When I delete the .ovr file and reopen the vrt-file all is well again.
I already tried running my GDALWarp command after creating the overviews
but that doesn't matter.

Creating a tiff-file instead of a vrt-file results in a correct result.

Is this a known and expected behavior of the VRT-format?
I really want to keep using the vrt-file since it is only 700kb instead of
the tiff-file which is 63MB and I will be doing more calculations later on,
which also result in new files.

If needed I can send my input files.

Thanks,

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170701/3d3689af/attachment.html>


More information about the gdal-dev mailing list