Ticket #4442 (new defect)
Warping onto an image with GCPs or geolocation array does not work
| Reported by: | korosov | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.9.1 |
| Component: | GDAL_Raster | Version: | svn-trunk |
| Severity: | normal | Keywords: | |
| Cc: | knutfrode |
Description
When I try to warp either projected image (e.g. Global DEM) or unprojected image (e.g. L1B MERIS or MODIS image) onto another UNprojected image (e.g. MODIS or MERIS image with GCPs or geolocation arrays) both the command line utility 'gdalwarp' and the function from the Python bindings 'ReprojectImage?' produce wrong results: the images are not colocated correctly but the source image is small and placed in the top left corner of the destination image.
Sample input data:
Source projected image: Global DEM at 1/12 degree resolution, 120MB (alwdgg.tif) http://www.eea.europa.eu/data-and-maps/data/world-digital-elevation-model-etopo5/zipped-dem-geotiff-raster-geographic-tag-image-file-format-raster-data/
Destination unprojected image: Envisat/MERIS at 1200 m resolution, 29MB (MER_RR2PNPDK20030809_100609_000022512018_00466_07534_3898.N1) http://envisat.esa.int/services/sample_products/meris/RR/L2/
1. Try with gdalwarp:
#make writable copy of the destination image with one band only: gdal_translate MER_RR__2PNPDK20030809_100609_000022512018_00466_07534_3898.N1 -b 1 meris_dst_01.tif #reproject global dem onto unprojected image with GCPs gdalwarp alwdgg.tif meris_dst_01.tif
The updated image meris_dst_01.tif contains small map of the world in the upper left corner.
2. Try with Python bindings
GCPfile='MER_RR__2PNPDK20030809_100609_000022512018_00466_07534_3898.N1' geotransformfile = 'alwdgg.tif' outfile = 'meris_dst_02.tif' # open input datasets src_ds = gdal.Open(geotransformfile) dst_ds = gdal.Open(GCPfile) # create writable copy of the destination image driver = gdal.GetDriverByName( "GTiff" ) out_ds = driver.CreateCopy(outfile, dst_ds, 0 ) # reproject onto destination image with GCPs gdal.ReprojectImage(src_ds, out_ds)
The created image meris_dst_02.tif contains small map of the world in the upper left corner.

