odc.geo.xr.ODCExtensionDa.add_to

ODCExtensionDa.add_to(map: Any, *, name: str | None = None, index: int | None = None, fmt: str = 'png', max_size: int = 4096, resampling: str = 'nearest', transparent_pixel: Tuple[int, int, int] | None = None, cmap: Any | None = None, clip: bool = False, vmin: float | None = None, vmax: float | None = None, robust: bool | None = None, **kw) Any

Add image to an interactive map.

If map is not supplied, image data url and bounds are returned instead.

Parameters:
  • xx (Any) – The DataArray to display

  • map (Any) – Map object, folium and ipyleaflet are understood; can also be None which will return an image data url and bounds instead.

  • name (Optional[str]) – The name of the layer as it will appear in folium and ipyleaflet Layer Controls. The default None will use the input array name (e.g. xx.name) if it exists.

  • fmt (str) – Compress image format. Defaults to “png”; also supports “webp”, “jpeg”.

  • max_size (int) – If longest dimension is bigger than this, shrink it down before compression; defaults to 4096.

  • resampling (str) – Custom resampling method to use when reprojecting xx to the map CRS; defaults to “nearest”.

  • transparent_pixel (Optional[Tuple[int, int, int]]) – Replace transparent pixels with this value, needed for “jpeg”.

  • cmap (Optional[Any]) – If supplied array is not RGB use this colormap to turn it into one.

  • clip (bool) – When converting to RGB clip input values to fit cmap.

  • vmin (Optional[float]) – Used with matplotlib colormaps

  • vmax (Optional[float]) – Used with matplotlib colormaps

  • robust (Optional[bool]) – Used with matplotlib colormaps, vmin=2%, vmax=98%

Raises:

ValueError – when map object is not understood

Return type:

Any

Returns:

ImageLayer that was added to a map

Returns:

(url, bounds) when map is None.

See also

colorize(), to_rgba()