[gdal-dev] GCP reprojection

Fabian Schindler fabian.schindler at eox.at
Tue Dec 18 07:06:53 PST 2012


Hey devs,

I've spent a full day to find a solution to this, but unfortunately was 
not able to solve it, so you are my last hope :)

I'm trying to reproject an image with GCPs to a CRS specified by WKT.

I used  `gdal.AutoCreateWarpedVRT` to retrieve the output image size + 
geotransform in conjunction with `gdal.ReprojectImage` to reproject the 
image. This worked well unless I have really few GCPs at my disposal 
(i.e: 6), then I just get the error "Failed to compute GCP transform: 
Transform is not solvable". (Funnily it works with only 4 GCPs).

I created a small C function to get the size and geotransform from an 
image with few GCPs (basically a small, Python callable wrapper for 
GDALSuggestedWarpOutput) with `order = 1` which helped me around the 
`gdal.AutoCreateWarpedVRT` error. But now I'm stuck with the 
`gdal.ReprojectImage`, which gives me the exact same error as above. 
("Failed to compute GCP transform: Transform is not solvable"). I've 
also tried to create a wrapper here to use `order=1` but this time it 
did not help and the error stayed.

My raster image size is 605x595 and I want to apply the following GCPs:

pixel      line          lon       lat

0.000000   0.000000   -> 16.100000 48.500000

604.000000 0.000000   -> 16.168000 48.503300

604.000000 297.000000 -> 16.168035 48.483500

604.000000 594.000000 -> 16.168040 48.463600

0.000000   594.000000 -> 16.100100 48.460000

0.000000   297.000000 -> 16.100000 48.480000

0.000000   0.000000   -> 16.100000 48.500000


Is there any (C) function I can use instead? Or any other method to 
reproject images with few GCPs?

Thanks,
Fabian

P.S: I'm using GDAL 1.9.1 on CentOS 6.


More information about the gdal-dev mailing list