Warping with cutline and blending for large and complex cut polygons
|Reported by:||asgerpetersen||Owned by:||warmerdam|
When warping with a cutline and using the blend option the processing time is heavily dependent on the complexity of the cut polygon. If a large part of the cut polygon falls outside the raster a lot of time is wasted in the GEOSDistance calls.
I have for instance tried cutting together two rasters of 2km x 2km using a coastline polygon which is very complex and has a bounding box of approx 300km x 300km. In this case it takes ~120 minutes to do the warp. If I reduce the coastline polygon to the relevant area the running time is ~14 minutes.
This approach could be incorporated in GDAL cutline algorithm by using something like (in pseudo code):
env = envelope(raster) expand(env, blending distance) reduced_cut_poly = intersection(env, cut_poly)
...and the using the reduced_cut_poly instead of the original polygon.
This would dramatically decrease the running time of the case with large and complex polygon and it would hardly affect the running time of other cases (assuming that GEOS has reasonable shortcut tests built in).