[gdal-dev] Warping onto an image with only GCPs
Knut-Frode Dagestad
knutfrodesoppel at hotmail.com
Thu Dec 15 09:47:47 EST 2011
Hi,
Hróbjartur Þorsteinsson explained to me a near-hidden feature of GDAL,
namely to reproject one image onto the coverage of another.
Given two images:
imageA.tiff
imageB.tiff
Then an empty image can be created from image A with e.g.
$ gdal_translate -ot Float32 -scale 0 0 999 999 -a_nodata 999
imageA.tiff domainA.tiff
And then imageB can be warped onto the extent of this image simply with:
$ gdalwarp imageB.tiff domainA.tiff
domainA.tiff will then contain the data from imageB, exactly co-located
with imageA.
The problem is that this only works when imageA contains a geotransform,
and not when it contains only GCPs.
So my question is:
Is there any workaround to warp data from one image onto another image
which is geolocated by GCPs only?
With the -to option of gdalwarp it is possible to pass some parameters
to GDALCreateGenImgProjTransformer2(). In the documentation of this
function I find the following option:
"METHOD: may have a value which is one of GEOTRANSFORM, GCP_POLYNOMIAL,
GCP_TPS, GEOLOC_ARRAY, RPC to force only one geolocation method to be
considered on the source dataset."
http://www.gdal.org/gdal__alg_8h.html#94cd172f78dbc41d6f407d662914f2e3
But there is no corresponding option to force use of GCP_POLYNOMIAL for
the *destination* dataset. I guess this is a bad sign?
Thank you for any help!
Knut-Frode
More information about the gdal-dev
mailing list