tracktable.render.render_heatmap module¶
Module contents¶
tracktable.render.heatmaps - render heatmaps in python
This is a set of functions that intend to allow user-friendly rendering of heatmaps. A user should be able to simply use the function render_heatmap(points) passing a single parameter that is a list of points and get a rendering of those points, whether running as an interactive map inside of a notebook or from the command line and saved as a static image to a file.
- tracktable.render.render_heatmap.render_heatmap(points, backend='', trajectories=None, **kwargs)[source]¶
Render a list of trajectories interactively or as a static image
This function will render a list of trajectories using Folium (for interactive display) if you are in a Jupyter notebook or using Cartopy (for a static image) if you are running from a script.
- Parameters
points (single points or list of points) – Points to render
- Keyword Arguments
backend (str) – Which back end to use. This can be ‘folium’ to force Folium interactive rendering or ‘cartopy’ to force static images. Defaults to None, which lets the renderer select automatically.
trajectories (Trajectory) – list of trajectories corresponding to the points, render trajectories if provided. (Default: None)
simplify_traj (bool) – Simplify trajectories prior to rendering them
simplify_tol (float) – Tolerance to use when simplifying trajectories, default is 0.0001
weights – (list) list of weights associated with each point (Default: None)
color_map – (str) name of matplotlib colormap to use for the heatmap (Default: ‘viridis’)
tiles (str) – name of map tiling to use (Default: ‘cartodbdark_matter’)
attr (str) – folium specific parameter (Default: ‘.’)
crs (str) – folium specific parameter (Default: “EPSG3857”)
show (bool) – whether or not to show the result (if possible) (default: True) if saving to a file, might not want to view.
save (bool) – whether or not to save the result to a file. For folium the results can be saved to an html file. For cartopy the results can be saved as an image. If no filename is given, a default filename including the timestamp is used. (default: False)
filename (str) – Path and filename to save the results to, if save is set to True. If no filename is given, a default filename including the timestamp is used.
map_projection (GeoAxes) – Map to render onto
point_source (iterable) – Sequence of 2D points. This will be traversed only once.
bounding_box (point2d) – Bounding box of area to generate histogram
bin_size (int) – Boundary size for bins (Default: 1)
colormap (str or Colormap) – Colors to use for histogram (Default: ‘gist_heat’)
colorscale (matplotlib.colors.Normalize or subclass) – Mapping from bin counts to color. Useful values are matplotlib.colors.Normalize() and matplotlib.colors.LogNorm(). (Default: matplotlib.colors.Normalize())
zorder (int) – Image priority for rendering. Higher values will be rendered on top of actors with lower z-order. (Default: 10)