odc.geo.xr.add_to

odc.geo.xr.add_to(xx, map, *, name=None, fmt='png', max_size=4096, transparent_pixel=None, cmap=None, clip=False, vmin=None, vmax=None, robust=None, **kw)[source]

Add image to a map.

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

Parameters:
  • xx (Any) – array to display

  • map (Any) – Map object, folium and ipyleaflet are understood, can be None.

  • name (Optional[str]) – Image layer name

  • fmt (str) – compress image format, defaults to “png”, can be “webp”, “jpeg” as well.

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

  • 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()