Can I use GDAL Translate to define 4 corners without reprojecting the image?

47 Views Asked by At

I would like to define four corners for an image without resampling or reprojecting the image. I can define two corners just fine with GDAL Translate, like this: gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr 17.5 57.5 17.8 57.4 test1.jpg test1-translate.tif

The result will overlay on Google Earth but it is not oriented correctly. To do that I need a third point.

I can add a third point using GDAL Translate and then GDALWARP, like this: gdal_translate -of GTiff -gcp 1 1 17.5 57.5 -gcp 1051 1 17.7 57.6 -gcp 1 715 17.6 57.3 -gcp 1051 715 17.8 57.4 test1.jpg test1-translate.tif gdalwarp -r near -tps -t_srs EPSG:4326 test1-translate.tif test1-warp.tif

But then my image grows (after resampling) and fills black in the corners. I have large images and this is a problem for me. I know I can achieve what I want and define additional corners using GDAL_Edit like this: gdal_edit -a_ulurll 17.5 57.5 17.7 57.6 17.6 57.3 test1-translated.tif And this drops on Google Earth perfectly without resampling the image and without black corners.

And that would be fine, except I don't know how to access GDAL Edit programmatically from within C.

So my question, is there a way to use GDALWarp to just add a third corner and not resampe all my pixel data? Is there anything wrong with this approach, given that my test with GDAL Edit appears to be just fine when dropped on Geoogle Earth? I though there might be a way to use GDALWarp with a NO_GEOTRANSFORM, but if there is I can't figure it out.

I don't feel like I need to warp my data to use it on Google Earth. Please help me understand if I am wrong.

0

There are 0 best solutions below