Used to load and display a single image over specific bounds of the map, implements ILayer interface. Parameters ---------- image: string or array-like object The data to overlay as an image. * If string is a path to an image file, its content will be converted
| 236 | |
| 237 | |
| 238 | class ImageOverlay(Layer): |
| 239 | """ |
| 240 | Used to load and display a single image over specific bounds of |
| 241 | the map, implements ILayer interface. |
| 242 | |
| 243 | Parameters |
| 244 | ---------- |
| 245 | image: string or array-like object |
| 246 | The data to overlay as an image. |
| 247 | |
| 248 | * If string is a path to an image file, its content will be converted and |
| 249 | embedded. |
| 250 | * If string is a URL, it will be linked. |
| 251 | * Otherwise a string will be assumed to be JSON and embedded. |
| 252 | * If array-like, it will be converted to PNG base64 string and embedded. |
| 253 | bounds: list/tuple of list/tuple of float |
| 254 | Image bounds on the map in the form |
| 255 | [[lat_min, lon_min], [lat_max, lon_max]] |
| 256 | opacity: float, default Leaflet's default (1.0) |
| 257 | alt: string, default Leaflet's default ('') |
| 258 | origin: ['upper' | 'lower'], optional, default 'upper' |
| 259 | Place the [0,0] index of the array in the upper left or |
| 260 | lower left corner of the axes. |
| 261 | colormap: callable, used only for `mono` image. |
| 262 | Function of the form [x -> (r,g,b)] or [x -> (r,g,b,a)] |
| 263 | for transforming a mono image into RGB. |
| 264 | It must output iterables of length 3 or 4, |
| 265 | with values between 0 and 1. |
| 266 | Hint: you can use colormaps from `matplotlib.cm`. |
| 267 | mercator_project: bool, default False. |
| 268 | Used only for array-like image. Transforms the data to |
| 269 | project (longitude, latitude) coordinates to the Mercator projection. |
| 270 | Beware that this will only work if `image` is an array-like object. |
| 271 | Note that if used the image will be clipped beyond latitude -85 and 85. |
| 272 | pixelated: bool, default True |
| 273 | Sharp sharp/crips (True) or aliased corners (False). |
| 274 | name : string, default None |
| 275 | The name of the Layer, as it will appear in LayerControls |
| 276 | overlay : bool, default True |
| 277 | Adds the layer as an optional overlay (True) or the base layer (False). |
| 278 | control : bool, default True |
| 279 | Whether the Layer will be included in LayerControls. |
| 280 | show: bool, default True |
| 281 | Whether the layer will be shown on opening. |
| 282 | |
| 283 | See https://leafletjs.com/reference.html#imageoverlay for more |
| 284 | options. |
| 285 | |
| 286 | """ |
| 287 | |
| 288 | _template = Template( |
| 289 | """ |
| 290 | {% macro header(this, kwargs) %} |
| 291 | {% if this.pixelated %} |
| 292 | <style> |
| 293 | .leaflet-image-layer { |
| 294 | /* old android/safari*/ |
| 295 | image-rendering: -webkit-optimize-contrast; |
nothing calls this directly
no test coverage detected
searching dependent graphs…