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

Frank Warmerdam warmerdam at pobox.com
Tue Jun 14 19:23:47 EDT 2011


On 11-06-14 07:04 PM, Cole, Derek wrote:
> Is it possible to use CreateCopy() to easily copy in to a new image modified
> raster data based off the old image? I know all the metadata is going to be the
> same, I have simply changed the data after reading it from the original, and
> need to store it back to disk.

Derek,

Well, I wouldn't say it is very easy, but there are a few approaches.
One approach would be to use CreateCopy() to copy the imagery, metadata
and other information into a memory dataset (using the MEM) driver.  Then
update the imagery on this MEM dataset according to what you need, and then
use CreateCopy() to copy the result to the final file.

It is also possible, but complicated, to create a VRT wrapper you can pass
to CreateCopy that pulls from your modified image and using the original file
for the metadata.

Generally for this sort of situation I would just CreateCopy to a geotiff file,
update the imagery, and then CreateCopy() from that to the final file.

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