Interface NoDataOptions

Options related to how no-data pixels are treated. No-data pixels are pixels that should be ignored for processing or visualization.


  • NoDataOptions


alpha?: number

(only if replaceNoData is enabled) When a no-data pixel is replaced by a valid value, its alpha channel is replaced by this value.

maxSearchDistance?: number

(only if replaceNoData is enabled) The maximum distance (in CRS units) to search in all directions to find values to interpolate from.

replaceNoData: boolean

Enables no-data replacement. The algorithm is similar to the GDALFillNodata() function in the GDAL library. The main difference is that the distance is in CRS units rather than pixels.

This algorithm replaces any no-data pixel by the nearest valid pixel color, within maxSearchDistance. The alpha value of the replaced pixel is specified by alpha. No-data pixels that are outside the distance are replaced by transparent black.

The main use cases are:

  • Hole filling: any hole that is smaller than maxSearchDistance will be filled with values at the edge of the hole. In this case alpha should be 1. Typically used for color and mask layers to remove small holes and other similar artifacts, or to smooth irregular edges.
  • Geometry smoothing. For elevation layers that contain no-data pixels, the geometry of the map will show steep walls at the boundary between valid and no-data pixels. In this case, we want to replace no-data pixels with nearest pixels while still making them transparent. Typically used for elevation layers. In this case, alpha should be 0, and maxSearchDistance should be set to either a big value (far enough from the dataset's edges), or +Infinity.

Generated using TypeDoc