Hi Frank (and others), > Jachym, > > The problem is that your output file does not have a geotransform set, > so ReprojectImage() does not realize the output file overlaps the > area available from the input file. You need to set the geotransform > before calling ReprojectImage(). Setting the coordinate system is not > critical since ReprojectImage() allows you to pass in an output coordinate > system. > > Best regards,
Thanks, it helped. Just for the record:
from osgeo import gdal
from osgeo.gdalconst import *
# let's have georeferenced geotiff
inds = gdal.Open("elevationwgs.tif")
# create the driver
driver = gdal.GetDriverByName("GTiff")
# create new output file, note the datatype must be set
outds = driver.Create("outfile.tif",inds.RasterXSize, inds.RasterYSize,
1,GDT_UInt16)
# set geotransform parameter
outds.SetGeoTransform(inds.GetGeoTransform())
# set the projection
outds.SetProjection(inds.GetProjection())
# do the transformation - actually no transformation at all
# projections are no longer needed, since both datasets are projected
gdal.ReprojectImage(inds, outds)
# close
outds = None
inds = None
--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/JachymCepicky.pgp
Key fingerprint: 0C6D 0EAE 76BD 506C F299 ED8A C8AB 74B8 08D4 E08F
signature.asc
Description: Digital signature
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
