gpxplotter.folium_map
This module defines methods for interfacing with folium.
- gpxplotter.folium_map.add_colored_line(the_map, segment, color_by, cmap='viridis', line_options=None, min_value=None, max_value=None)[source]
Add segment as a colored line to a map.
Add a line colored by some value to the given map.
- Parameters:
the_map (object like
folium.folium.Map
) – The map to add the segment to.segment (dict) – The segment to add.
color_by (string) – This string selects what property we will color the segment according to.
cmap (string) – The colormap to use for coloring.
line_options (dict) – Extra control options for drawing the line.
min_value (the minimum value for the colormap.) – If None it will be determined from the segment data.
max_value (the maximum value for the colormap.) – If None it will be determined from the segment data.
- gpxplotter.folium_map.add_marker_at(the_map, segment, index, tooltip, **kwargs)[source]
Add start marker at the given index.
- Parameters:
the_map (object like
folium.folium.Map
) – The map to add the markers to.segment (dict) – The segment to add marker for.
index (int) – The point in the segment to add marker to.
tooltip (string) – The tooltip to be added to the marker.
kwargs (optional) – Arguments passed on to
folim.Icon
.
- gpxplotter.folium_map.add_segment_to_map(the_map, segment, color_by=None, cmap='viridis', line_options=None, fit_bounds=True, add_start_end=True, min_value=None, max_value=None)[source]
Add a segment as a line to a map.
This method will add a segment as a line to the given map. The line can be colored according to values selected by the parameter
color_by
.- Parameters:
the_map (object like
folium.folium.Map
) – The map to add the segment to.segment (dict) – The segment to add.
color_by (string, optional) – This string selects what property we will color the segment according to. If this is None, the segment will be displayed with a single color.
cmap (string) – The colormap to use if
color_by != None
.line_options (dict) – Extra control options for drawing the line.
fit_bounds (boolean, optional) – Determines if we try to fit the map so the whole segment is shown.
add_start_end (boolean, optional) – If True, this method will add markers at the start/end of the segment.
min_value (the minimum value for the colormap.) – If None it will be determined from the segment data.
max_value (the maximum value for the colormap.) – If None it will be determined from the segment data.
- gpxplotter.folium_map.add_start_top_markers(the_map, segment)[source]
Add markers for the start and end of the segment.
- Parameters:
the_map (object like
folium.folium.Map
) – The map to add the markers to.segment (dict) – The segment to use for finding the start and end points.
- gpxplotter.folium_map.add_tiles_to_map(the_map, *tiles)[source]
Add pre-defined tiles to the given map.
- Parameters:
the_map (object like
folium.folium.Map
) – The map to add tiles to.tiles (list of strings) – The name of the tiles to add.
- gpxplotter.folium_map.create_folium_map(**kwargs)[source]
Create a folium map.
This method is essentially the same as calling
folium.Map(**kwargs)
, with a few differences:control_scale = True
by default.tiles
can be"openstreetmap"
,"cartodb positron"
,"cartodb voyager"
, or any of the tiles defined inTILES
.
- Parameters:
kwargs (optional) – Arguments passed to the method generating the map, see
folium.Map()
.- Returns:
the_map (object like
folium.folium.Map
) – The map created here.