[gdal-dev] Creating a VRT dataset from overviews in C++

Dmitry Baryshnikov polimax at mail.ru
Fri May 11 04:53:46 EDT 2012


11.05.2012 11:50, Thomas Sevaldrud написал:
>
>     10.05.2012 23:14, Thomas Sevaldrud написал:
>>     Hi Dmitry, and thanks for your answer!
>     Hi Thomas!
>>
>>     I was actually looking at this patch earlier today, but I also
>>     wanted to see if I could solve it without patching.
>>
>>     Will this patch be included in the official source?
>     My patch needs some refactoring and testing on python bindings.
>     The work is going on , but not so fast as I wish. As I finished
>     and commit my code, It'll be some testing period and than fixes
>     will be accepted.
>>
>>     Is it possible to do it the way I described in the previous mail?
>     Yes, you can try to warp and overview images (bands). You can get
>     an overview of needed level from GDALRasterBand Class via
>     GetOverview (int) method, but than you need to work on band basis
>     and mixed them in colour image by yourself.
>
>
> This is probably a stupid question, but I couldn't find it anywhere in 
> the documentation. How do I create a GDALDataset from a set of 
> existing GDALRasterBands?
>
> I guess I could copy the pixel data with the RasterIO methods, but I 
> was hoping I could make a VRT or something from a set of existing 
> overview bands and then do the warping on this, to avoid the copying 
> of a potentially huge dataset.
I don't sure 100% but you can play with VRTDataset. Look at this 
method:  GDALAddBand and VRTAddSimpleSource. Maybe CreateVRTSeparate 
method from apps\gdalbuildvrt.cpp will be helpful.
>
> - Thomas
>
>>     Cheers,
>>     Thomas
>>
>>     On Thu, May 10, 2012 at 7:11 PM, Dmitry Baryshnikov
>>     <polimax at mail.ru <mailto:polimax at mail.ru>> wrote:
>>
>>         10.05.2012 19:03, tseval написал:
>>>         Hi,
>>>
>>>         I'm trying to cut and reproject a large image with overviews using the c++
>>>         api. This runs extremely slow when I produce highly downsampled cutouts
>>>         covering large areas of the original image.
>>>
>>>         I understand the the Warp API doesn't use the overviews when resampling, so
>>>         I wanted to make a temporary dataset from one of the downscaled overviews
>>>         and do the warping on this dataset instead.
>>>
>>>         First of all, is this a sensible way of doing things? If so, what driver
>>>         should I use? I guess VRT? I have been trying to create a VRT by doing
>>>         something like this:
>>>
>>>         	double scaleX = (double)ovrW/origW;
>>>         	double scaleY = (double)ovrH/origH;
>>>         	GDALDataset* vrtDS = vrtDriver->Create("", ovrW, ovrH, _numBands,
>>>         _dataType, NULL);
>>>         	GDALSetProjection(vrtDS, _srcProjectionWKT);
>>>         	double geoTransform[6];
>>>         	srcDS->GetGeoTransform(geoTransform);
>>>         	geoTransform[XFM_PIXEL_SIZE_EW] = scaleX*geoTransform[XFM_PIXEL_SIZE_EW];
>>>         	geoTransform[XFM_PIXEL_SIZE_NS] = scaleY*geoTransform[XFM_PIXEL_SIZE_NS];
>>>         	vrtDS->SetGeoTransform(geoTransform);
>>>
>>>         But how am I supposed to set the bands in the VRT from the downscaled
>>>         overview bands in the original image?
>>>
>>>         Any help on this would be greatly appreciated :)
>>>
>>>
>>>         --
>>>         View this message in context:http://osgeo-org.1560.n6.nabble.com/Creating-a-VRT-dataset-from-overviews-in-C-tp4965891.html
>>>         Sent from the GDAL - Dev mailing list archive at Nabble.com.
>>>         _______________________________________________
>>>         gdal-dev mailing list
>>>         gdal-dev at lists.osgeo.org  <mailto:gdal-dev at lists.osgeo.org>
>>>         http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>>
>>         Hi,
>>
>>         You can try to use this patch to enable overviews in VRT
>>         http://trac.osgeo.org/gdal/ticket/2076
>>         or waits as I accomplish my work on fixing this
>>         situation.<http://trac.osgeo.org/gdal/ticket/2076>
>>
>>         Best regards,
>>             Dmitry
>>
>>         _______________________________________________
>>         gdal-dev mailing list
>>         gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>>         http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>>
>     Best regards,
>         Dmitry
>
>
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120511/26e32f94/attachment.html


More information about the gdal-dev mailing list