Oliver Eichler wrote:
Hi,

I would like to change the offset of a referenced file. I use
GDALDataset::GetGeoTransform(adfGeoTransform) to read the current
settings. I change adfGeoTransform[0] and adfGeoTransform[3] and use
GDALDataset::SetGeoTransform(adfGeoTransform) to replace the old settings.

Of course that does not work. GDAL tells me that this works only on
newly created datasets. Well ok. 2nd try:

Oliver,

What file format are you working with?  Your approach is appropriate,
but not all drivers support changing metadata like the geotransform after
the file has been created on disk.

I use GDALDriver::CreateCopy() to create new dataset and to copy all
data. But even with the new copy
GDALDataset::SetGeoTransform(adfGeoTransform) fails for the  same reason.

File formats that only support CreateCopy(), and not Create(), will
generally require you to set the appropriate geotransform in the source
dataset before calling CreateCopy().  It is possible to create a
virtual dataset wrapped around your real source, and set the updated
geotransform on that.  This is how gdal_translate handles stuff like
changing the coordinate system, and geotransform.

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

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to