Denis,

Le 05/12/2021 à 00:09, Denis Rykov a écrit :
According to rasterio's documentation <https://rasterio.readthedocs.io/en/latest/topics/reproject.html> "reproject" is a geospatial-specific analog to SciPy’s geometric_transform <https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.geometric_transform.html#scipy.ndimage.geometric_transform>. But the thing is "geometric_transform" doesn't support masked arrays so it can't properly transform images with nodata value. My question: is it possible to write a custom transformer function and use it in GDAL to transform an image (considering nodata) to overcome the lack of the appropriate functionality in SciPy.

If you use the low level C++  API you should be able to do that.

You' ll need to use GDALWarpOperation as the entry point, and initialize it with GDALWarpOptions with your custom transformer function in the pfnProgress / pProgressArg members

You may use apps/gdalwarp_lib.cpp or frmts/vrt/vrtwarped.cpp as examples of how to use those API. This is not entirely trivial admittedly.

Actually I was thinking a nice contribution, and perhaps simpler than having your own warping code, could be to enhance the GDALWarpApp API of apps/gdalwarp_lib.cpp to have a GDALWarpAppOptionsSetTransformer() function where users could specify their own transformer which would skip the creation of the default one.

Even

--

http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to