map_maker (Bokeh)

These are the functions in the map_maker module.

map_maker.bokeh functions

base_map_plot(x_range, y_range[, tools, …])

Builds a blank map tile plot.

make_map_plot(map_data[, plot_height, …])

Creates a Bokeh map from a list of dicts with geometry / style info.

Module contents

Copyright 2020 Expedia, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

map_maker.bokeh.map_maker.base_map_plot(x_range, y_range, tools='pan, wheel_zoom, reset', plot_height=800, plot_width=800, tiles=WMTSTileSource(id='1001', ...))

Builds a blank map tile plot.

Builds a blank figure with map tiles, but without axes, labels and ticks.

Parameters
  • x_range (list of float) – The minimum and maximum x coordinates for the plot.

  • y_range (list of float) – The minimum and maximum y coordinates for the plot.

  • tools (str) – A comma separated list of strings defining the tools for the Bokeh plot widget.

  • plot_height (float) – The height of the plot in px.

  • plot_width (float) – The width of the plot in px.

  • tiles (bokeh.models.tiles.WMSTTileSource) – The tile source for the blank map. Default is CartoDB Positron Retina.

Returns

fig – The Bokeh Figure for the blank map.

Return type

bokeh.plotting.Figure

map_maker.bokeh.map_maker.make_map_plot(map_data, plot_height=800, plot_width=800, tiles=WMTSTileSource(id='1002', ...), point_size=2, polygon_line_width=2, linestring_width=2, tooltips={'points'})

Creates a Bokeh map from a list of dicts with geometry / style info.

Takes a list of dictionaries, each of which has the following fields:

{
    "shape": # WKT | GeoJSON String | Geo-Interface | Shapely Geometry
    "alpha": # Alpha value of the fill.
    "color": # Color of the shape
}
Parameters
  • map_data (list of dict) – A list of dictionaries defining the shape and style to map with the fields defined above.

  • plot_height (int) – The height of the plot in px.

  • plot_width (int) – The width of the plot in px.

  • tiles (bokeh.models.tiles.WMSTTileSource) – The tile source for the map. Default is CartoDB Positron Retina.

  • point_size (float, default 2.) – The size of the points to plot, if there are any points present.

  • polygon_line_width (float, default 2.) – The line width of the polygon outline, if there are any polygons present. Set to 0 to disable polygon outlines.

  • linestring_width (float, default 2.) – The line width of the linestring, if there are any linestrings present.

  • tooltips (set) – The labels of tooltips to display, can be “points”, “linestrings”, “polygons” or both any combination.

Returns

fig – The Bokeh Figure for the map.

Return type

bokeh.plotting.Figure