<div dir="ltr">When using the same image in GeoTIFF with overviews, it works correctly, which may indicate something with the ECW drivers. I suppose it must be something triggered by something weird I'm doing though, or else I would think that other people would have the same problem.<div><br></div><div>The weird thing is that if I simply add an extra band to the VRT it works with ECW as well... This extra band is never used for anything and has no source, but with it, I get the correct image.</div><div><br></div><div>I can't switch to GDAL 2.0 yet, but I'll try to isolate the code from the GDALOverviewDataset class and use that instead of the VRT approach, and see if that makes any difference.</div><div class=""><div id=":1om" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div><span class=""><font color="#888888"><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">- Thomas</div><div><br></div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 15, 2015 at 12:19 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thomas,<br>
<br>
2 suggestions to help narrowing down the issue :<br>
- try gdalwarp of GDAL 2.0 that can select the most appropriate overview<br>
given the target resolution / raster size<br>
- try with the ECW translated as a GeoTIFF to check if it isn't an issue with<br>
the ECW driver itself.<br>
<br>
Even<br>
<div class="HOEnZb"><div class="h5"><br>
> Hi,<br>
><br>
> I am having a bit of trouble with warping a dataset (an ECW file) with<br>
> multiple overviews. The base file is huge, so I am selecting the overview<br>
> that matches closest to my output resolution and makes an in-memory VRT of<br>
> this, consisting of the overview bands of the original image.<br>
><br>
> This seems to only work for some overview levels, and not for others. I get<br>
> results that appear to be made from the correct sets of colors basically,<br>
> but way out of scale and postion. Some times it seems to work nicely<br>
> though, so I suspect that there is some memory overwriting issue or<br>
> something here.<br>
><br>
> This is the part of the code that builds the overview VRT. The input<br>
> dataset is _ds, an<br>
><br>
> // Create a VRT of the closest matching overlay<br>
> GDALDriver *vrtDriver = (GDALDriver *) GDALGetDriverByName( "VRT" );<br>
><br>
> vrtDS = vrtDriver->Create("", ovrW, ovrH, _numBands, _dataType, NULL);<br>
> GDALSetProjection(vrtDS, _srcProjectionWKT.c_str());<br>
><br>
>    ouble geoTransform[6]; _ds->GetGeoTransform(geoTransform); double<br>
> basePixelSizeX = geoTransform[XFM_PIXEL_SIZE_EW]; double basePixelSizeY =<br>
> geoTransform[XFM_PIXEL_SIZE_NS];<br>
><br>
> geoTransform[XFM_PIXEL_SIZE_EW] = scaleX*basePixelSizeX;<br>
> geoTransform[XFM_PIXEL_SIZE_NS] = scaleY*basePixelSizeY;<br>
> vrtDS->SetGeoTransform(geoTransform);<br>
><br>
> for(int i = 1; i <= _numBands; i++)<br>
> {<br>
> GDALRasterBand* srcRootBand = _ds->GetRasterBand(i);<br>
> GDALRasterBand* srcBand = srcRootBand->GetOverview(overviewId);<br>
> VRTSourcedRasterBand* vrtBand =<br>
> (VRTSourcedRasterBand*)vrtDS->GetRasterBand(i);<br>
> vrtBand->AddSimpleSource(srcBand);<br>
> }<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</font></span></blockquote></div><br></div>