tracktable.render.backends.folium_backend module

Note

This module is used by render_trajectories and render_heatmap and shouldn’t be accessed directly.

Module contents

tracktable.render.folium - render trajectories in using the folium backend

tracktable.render.backends.folium_backend.bounding_box_for_folium(trajectories)[source]

Translates a computed bounding box to the format needed by folium

tracktable.render.backends.folium_backend.render_heatmap(points, trajectories=None, weights=None, color_map='viridis', tiles='cartodbdark_matter', attr='.', crs='EPSG3857', show=False, save=False, filename='')[source]

Creates an interactive heatmap visualization

Parameters

points (list) – list of points

Keyword Arguments
  • trajectories – (Trajectoies) list of trajectories corresponding to the points, render trajectories if provided (Default: None)

  • 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.

Returns: an interactive heatmap

tracktable.render.backends.folium_backend.render_point(current_point, point_popup_properties, coord, point_radius, point_color, map_canvas)[source]

Renders a point to the folium map

Parameters
  • current_point (point) – Current point of the trajectory

  • point_popup_properties (list) – Point properties

  • coord (tuple) – Coordinates to render point

  • point_radius (int) – Size of the point to render

  • point_color (str) – Color of the point to render

  • map (Basemap) – Folium map

Returns

No return value

tracktable.render.backends.folium_backend.render_trajectories(trajectories, map_canvas=None, obj_ids=[], map_bbox=None, show_lines=True, gradient_hue=None, color_map='', line_color='', linewidth=2.4, show_points=False, point_size=0.6, point_color='', show_dot=True, dot_size=0.7, dot_color='white', trajectory_scalar_generator=<function path_length_fraction_generator>, trajectory_linewidth_generator=None, color_scale=matplotlib.colors.Normalize, show=False, save=False, filename='', tiles='cartodbdark_matter', attr='.', crs='EPSG3857', point_popup_properties=[], show_distance_geometry=False, distance_geometry_depth=4, zoom_frac=[0, 1], show_scale=True, max_zoom=22, fast=False, **kwargs)[source]

Render a list of trajectories using the folium backend

For documentation on the parameters, please see render_trajectories