Ticket #2840 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Rasterize/Cutline - include any crossed pixel

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.7.0
Component: Algorithms Version: unspecified
Severity: normal Keywords: warp rasterize cutline
Cc: vjetly, ysid

Description

Yusuf has requested that the gdalwarp cutline support be extended with an option to include all pixels crossed by the cutline, not only those for which the center of the pixel is within the polygon.

It appears this will require changes to GDALdllImageFilledPolygon() in gdal/alg/llrasterize.cpp. This option would need to be controlled by an option to the GDAL warper. At the same time it might as well be exposed for the regular users of the rasterization API, including the gdal_rasterize command.

Change History

Changed 3 years ago by warmerdam

  • cc vjetly, ysid added

Changed 3 years ago by warmerdam

  • status changed from new to assigned

Starting work on this in trunk.

Changed 3 years ago by warmerdam

Support for this added in trunk (r17041). The option is enabled with the warp option CUTLINE_ALL_TOUCHED=YES. The ALL_TOUCHED option is also available in the rasterize functions and can be turned on with the -at switch to gdal_rasterize.

Note that "all touched" can act rather unpredictably for polygon edges or lines that fall exactly on pixel boundaries.

Changed 3 years ago by warmerdam

Some additional documentation added (r17042).

Changed 3 years ago by warmerdam

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone set to 1.7.0

Added some minimal testing (r17045).

Note: See TracTickets for help on using tickets.