Thursday 19 May 2016

gdal - Using gdalwarp with c# bindings?


I want to change projections for images using gdal bindings for c#. Gdal_translate seems like just renaming of projection (using a_srs parameter), but not reprojecting, so I used gdalwarp with s_srs parameter for that task. It's pretty clear what to pass to the Gdal.wrapper_GDALTranslate function: path to the destination file, dataset of the input file and some minor stuff. It also has more or less clear documentation. But for gdalwarp there are 3 kinds of different methods:


Gdal.wrapper_GDALWarpDestName(string dest, int object_list_count, 
SWIGTYPE_p_p_GDALDatasetShadow poObjects,

GDALWarpAppOptions warpAppOptions, Gdal.GDALProgressFuncDelegate callback,
string callback_data); //returns Dataset

Gdal.wrapper_GDALWarpDestDS(Dataset dstDS, int object_list_count,
SWIGTYPE_p_p_GDALDatasetShadow poObjects, GDALWarpAppOptions warpAppOptions,
Gdal.GDALProgressFuncDelegate callback, string callback_data); //returns int

Gdal.AutoCreateWarpedVRT(Dataset src_ds, string src_wkt, string dst_wkt,
ResampleAlg eResampleAlg, double maxerror); //returns Dataset


It's absolutely not clear what these functions do and how they do it. Docs on gdalwarp page don't have any of these. I also don't understand the parameters: there is no input file or dataset parameter, only destination ones; the SWIGTYPE_p_p_GDALDatasetShadow class, which also doesn't have docs (there are not a single word about "shadow" either).


Summarizing, I'd like to hear some explanations about how this funcs work and how to make them work as binary gdalwarp.exe does.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...