<div dir="ltr">Thanks, it was very helpful!<br><div><br></div>Also I found that some transformations can be expressed via the CoordinateOperation property (<i>-ct </i>parameter for gdalwarp).<div>But I do agree that having a way to specify a custom transformer seems very appealing! </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 5, 2021 at 6:08 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Denis,<br>
</p>
<div>Le 05/12/2021 à 00:09, Denis Rykov a
écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">According to rasterio's <a href="https://rasterio.readthedocs.io/en/latest/topics/reproject.html" target="_blank">documentation</a> "reproject" is a
geospatial-specific analog to SciPy’s <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.geometric_transform.html#scipy.ndimage.geometric_transform" target="_blank">geometric_transform</a>.<br>
<div>But the thing is "geometric_transform" doesn't support
masked arrays so it can't properly transform images with
nodata value.<br>
</div>
<div>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.</div>
</div>
</blockquote>
<p>If you use the low level C++ API you should be able to do that.</p>
<p>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</p>
<p>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.</p>
<p>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.<br>
</p>
<p>Even<br>
</p>
--
<pre cols="72"><a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</blockquote></div>