[gdal-dev] Custom geometric transformation

Denis Rykov rykovd at gmail.com
Mon Dec 6 09:25:35 PST 2021


Thanks, it was very helpful!

Also I found that some transformations can be expressed via the
CoordinateOperation property (*-ct *parameter for gdalwarp).
But I do agree that having a way to specify a custom transformer seems very
appealing!

On Sun, Dec 5, 2021 at 6:08 PM Even Rouault <even.rouault at spatialys.com>
wrote:

> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211206/d69c9f4d/attachment.html>


More information about the gdal-dev mailing list