Skip to content

Expose GDALFillNodata papszOptions in rasterio.fill.fillnodata #3175

@user2856

Description

@user2856

The GDAL C++ function GDALFillNodata supports additional name=value options:

papszOptions -- additional name=value options in a string list.

  • TEMP_FILE_DRIVER=gdal_driver_name. For example MEM.
  • NODATA=value (starting with GDAL 2.4). Source pixels at that value will be ignored by the interpolator. Warning: currently this will not be honored by smoothing passes.
  • INTERPOLATION=INV_DIST/NEAREST (GDAL >= 3.9). By default, pixels are interpolated using an inverse distance weighting (INV_DIST). It is also possible to choose a nearest neighbour (NEAREST) strategy.

rasterio.fill.fillnodata does not accept these additional options. The TEMP_FILE_DRIVER is used internally by rasterio, but it would be useful to expose the other two.

A use case for NODATA=value can be seen in this GIS StackExchange Q&A. The asker wishes to only fill some, not all NoData areas but doesn't want the excluded NoData values to be used for the interpolation. A couple of simple examples would be filling SLC-Off Landsat 7 gaps but not filling/using the NoData areas in the raster but outside the scene or filling in lakes but not oceans in a DEM where all water bodies are NoData.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions