I am attempting to do the following from code:

gdal_translate.exe --config GDAL_DATA "D:\gdal\bin\gdal-data" -of GTiff -a_srs EPSG:4326 -gcp 0 0 -108.724530873811 40.1376029956585 ..<truncated>.. -gcp 1920 1080 -108.700701203799 40.0986057211287 z.png y.tif

gdalwarp.exe --config GDAL_DATA "D:\gdal\bin\gdal-data" -of GTiff -wo "SAMPLE_GRID=YES" -wo "SAMPLE_STEPS=100" -overwrite -tps -r cubic -s_srs EPSG:4326 -t_srs EPSG:4326 -srcnodata "0 0 0" -dstnodata "0 0 0" y.tif y_done.tif

Starting with a non-georeference png file (obtained from a camera mounted on an aircraft), I add externally calculated GCPs to create a GeoTIFF. Using that GeoTIFF, I want to warp that image to display it on a 2d map.

Using the -tps option in the gdalwarp command has so-far provided the best alignment for the resulting image.

In C# code, I am struggling to achieve the same final result using AutoCreateWarpedVRT:

Dataset dswarp = Gdal.AutoCreateWarpedVRT(dsTiff, s_srs_wkt, t_srs_wkt, ResampleAlg.GRA_CubicSpline, 0.125);
ds_out = dvTiff.CreateCopy(path + ".wrp.tif", dswarp, 0, null, null, "");

This creates a warped GeoTIFF but appears similar to an -order 2 (per the VRT file) polynomial rather than tps.

Any thoughts? And am I even going about this the right way?


Unfortunately, the only answer I found was to dive into C/C++ instead of the C# wrapper. There just wasn't enough exposed functionality for me to using the C# wrapper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.