|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 |
|
3 | | -""" |
4 | | -Heat map |
5 | | --------- |
6 | | -
|
7 | | -Create a HeatMap layer |
8 | | -
|
9 | | -""" |
10 | | - |
11 | 3 | from __future__ import (absolute_import, division, print_function) |
12 | 4 |
|
13 | 5 | import json |
|
21 | 13 |
|
22 | 14 |
|
23 | 15 | class HeatMap(TileLayer): |
| 16 | + """ |
| 17 | + Create a Heatmap layer |
| 18 | +
|
| 19 | + Parameters |
| 20 | + ---------- |
| 21 | + data : list of points of the form [lat, lng] or [lat, lng, weight] |
| 22 | + The points you want to plot. |
| 23 | + You can also provide a numpy.array of shape (n,2) or (n,3). |
| 24 | + name : str |
| 25 | + The name of the layer that will be created. |
| 26 | + min_opacity : default 1. |
| 27 | + The minimum opacity the heat will start at. |
| 28 | + max_zoom : default 18 |
| 29 | + Zoom level where the points reach maximum intensity (as intensity |
| 30 | + scales with zoom), equals maxZoom of the map by default |
| 31 | + max_val : float, default 1. |
| 32 | + Maximum point intensity |
| 33 | + radius : int, default 25 |
| 34 | + Radius of each "point" of the heatmap |
| 35 | + blur : int, default 15 |
| 36 | + Amount of blur |
| 37 | + gradient : dict, default None |
| 38 | + Color gradient config. e.g. {0.4: 'blue', 0.65: 'lime', 1: 'red'} |
| 39 | +
|
| 40 | + """ |
24 | 41 | def __init__(self, data, name=None, min_opacity=0.5, max_zoom=18, |
25 | 42 | max_val=1.0, radius=25, blur=15, gradient=None, overlay=True): |
26 | | - """Create a Heatmap layer |
27 | | -
|
28 | | - Parameters |
29 | | - ---------- |
30 | | - data : list of points of the form [lat, lng] or [lat, lng, weight] |
31 | | - The points you want to plot. |
32 | | - You can also provide a numpy.array of shape (n,2) or (n,3). |
33 | | - name : str |
34 | | - The name of the layer that will be created. |
35 | | - min_opacity : default 1. |
36 | | - The minimum opacity the heat will start at. |
37 | | - max_zoom : default 18 |
38 | | - Zoom level where the points reach maximum intensity (as intensity |
39 | | - scales with zoom), equals maxZoom of the map by default |
40 | | - max_val : float, default 1. |
41 | | - Maximum point intensity |
42 | | - radius : int, default 25 |
43 | | - Radius of each "point" of the heatmap |
44 | | - blur : int, default 15 |
45 | | - Amount of blur |
46 | | - gradient : dict, default None |
47 | | - Color gradient config. e.g. {0.4: 'blue', 0.65: 'lime', 1: 'red'} |
48 | | - """ |
49 | 43 | super(TileLayer, self).__init__(name=name) |
50 | 44 | self._name = 'HeatMap' |
51 | 45 | self.tile_name = name if name is not None else self.get_name() |
|
0 commit comments