Opened 15 months ago

Last modified 15 months ago

#6507 new defect

after updating to 2.1.0, gdalwarp takes forever to complete

Reported by: dsogari Owned by: warmerdam
Priority: high Milestone:
Component: default Version: 2.1.0
Severity: normal Keywords: gdalwarp cutline blend
Cc:

Description

The following command executes flawlessly using GDAL 2.0.2:

gdalwarp -of GTiff -cutline polygon.kml -crop_to_cutline -wo CUTLINE_ALL_TOUCHED=TRUE -wo CUTLINE_BLEND_DIST=1 map.tiff map_out.tiff

However, when executed in GDAL 2.1.0, it takes forever to complete.

I investigated the code and discovered it has something to do with the blend distance option. There is a loop inside the BlendMaskGenerator? function in gdalcutline.cpp. This loop is executed very quickly in GDAL 2.0.2, but takes too long in 2.1.0.

For the life of me I can't figure out why. I just know that compiling the previous code of the gdalwarp utility with the 2.1.0 version of the lib does not trigger the issue.

The sample input files are attached. Please tell us if you experience the same issue and help us. We are almost done migrating our codebase.

Thank you in advance

Attachments (1)

polygon.kml (458 bytes) - added by dsogari 15 months ago.
input cutline

Download all attachments as: .zip

Change History (5)

Changed 15 months ago by dsogari

Attachment: polygon.kml added

input cutline

comment:1 Changed 15 months ago by dsogari

Sorry, the input raster is too big. I'll upload it to a server and then post the link here.

comment:2 Changed 15 months ago by dsogari

The link for the sample input raster: http://inf.ufrgs.br/~dsogari/map.tiff

comment:3 Changed 15 months ago by Even Rouault

trunk r34209, branches/2.1 r34210 "gdalwarp: do not densify cutlines by default when CUTLINE_BLEND_DIST is used (#6507)"

You can workaround the issue by defining the configuration option/environment variable GDALWARP_DENSIFY_CUTLINE=NO. The issue only happens when CUTLINE_BLEND_DIST is used

A better fix, but more involved, would be to try improving BlendMaskGenerator?() in apps/gdalwarp_lib.cpp to avoid as many point-to-polygon distance computations.

comment:4 Changed 15 months ago by dsogari

Thanks! This workaround will suffice for us.

Note: See TracTickets for help on using tickets.