Am 31.05.2010 19:13, schrieb Frank Warmerdam: > 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.
Hi Frank, it's a GeoTiff. Is it possible with that format or should I have better have a look into the gdal_translate code? Oliver > >> 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, _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
