[gdal-dev] CreateCopy() with same metadata, different raster data

Frank Warmerdam warmerdam at pobox.com
Wed Jun 15 10:44:20 EDT 2011


On 11-06-14 09:18 PM, Cole, Derek wrote:
> Hrmm, that is sort of unfortunate. I have set up a tiling algorithm to read
> in tiles at a time of imagery data, which is already slow-ish, even doing it
> it with threads. Having to do a whole new read of the entire image at once
> (since it doesnt seem CreateCopy takes any block parameters) would be pretty
> time consuming.
>
> Am I better off trying to just copy the Dataset manually, creating a new
> file from that?

Derek,

If efficiency is important, and you have a limited amount of metadata
you need to copy, I would setup your imagery in memory as a MEM dataset
and then programatically copy the parts of the metadata you need to it
from the source file.  Then do a CreateCopy from that to your final file.

You can ee something like that done in C in the MapServer msSaveImageGDAL()
function at:

   http://trac.osgeo.org/mapserver/browser/trunk/mapserver/mapgdal.c#L152

In all this I am assuming your final format is one that only supports
CreateCopy() (like JPEG or PNG) otherwise you can just imperatively
create the output file and set the info on it after writing the imagery.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list