add_to_map(arr, map, name=None, range=None, cmap=None, checkerboard=True, interpolation='linear')¶
By giving a name, you can change and re-run notebook cells without piling up extraneous layers on your map.
As you pan around the map, the part of the array that’s in view is computed on the fly by dask. This requires using a dask distributed cluster.
DataArrayto visualize. Must have
y, and optionally
banddims, and the
arrmust have 1-3 bands. Single-band data can be colormapped; multi-band data will be displayed as RGB. For 2-band arrays, the first band will be duplicated into the third band’s spot, then shown as RGB.
Map) – ipyleaflet Map to show the array on.
name (str) –
Name of the layer. If there’s already a layer with this name on the map, its URL will be updated. Otherwise, a new layer is added.
If None (default),
arr.nameis used as the name. If a layer with this name already exists, it will be replaced.
Min and max values in
arrwhich will become black (0) and white (255) in the visualization.
If None (default), it will automatically use the 2nd/98th percentile values of the entire array (unless it’s a boolean array; then we just use 0-1). For large arrays, this can be very slow and expensive, and slow down tile rendering a lot, so passing an explicit range is usually a good idea.
If None (default), the default matplotlib colormap (usually
viridis) will automatically be used for 1-band data. Setting a colormap for multi-band data is an error.
Whether to show a checkerboard pattern for missing data (default), or leave it fully transparent.
Note that only NaN is considered a missing value; any custom fill value should be converted to NaN before visualizing.
Literal[‘linear’, ‘nearest’]) – Interpolation method to use while reprojecting:
"linear"for continuous data, such as imagery, SAR, DEMs, weather data, etc. Use
"nearest"for discrete/categorical data, such as classification maps.
The new or existing layer for visualizing this array.
- Return type