map_datasets#
- caf.viz.web.mapping.map_datasets(datasets, mask=None, mask_name=None, textbox_text='\n <p>You can turn layers on/off in the right-hand corner\n and you can drag the legend boxes to another position on the map.</p>\n ', output_path=None)[source]#
Produce single HTML map including all datasets.
A single interactive map will be produced, filtered to the mask if provided. A textbox is included with instructions on how to use the map, which can be customised with the textbox_text parameter.
- Parameters:
datasets (Mapping[str, MapData]) –
Datasets must be provided as a dictionary of name to MapData. MapData includes the GeoDataFrame, an optional color column to plot, and extra options
for plotting (ExploreOptions).
mask (geometry.Polygon | geometry.MultiPolygon | gpd.GeoDataFrame | gpd.GeoSeries | None,) –
- optional
Mask to be used to filter data for mapping. Must be a single geometry object (Polygon or MultiPolygon) of the correct CRS
(EPSG:4326).
- If it is a GeoDataFrame/GeoSeries, it will be unioned to create the mask geometry and
CRS will be adjusted if necessary.
By default None.
mask_name (str | None, optional) – Name of the mask (filtering) layer. By default None.
textbox_text (str, optional) – Text to go into the foldable textbox in bottom left of map. By default TEXT_NOSPLIT.
output_path (pathlib.Path | None, optional) –
Output path to write the HTML map. If a directory is provided, the map will be written to a file called “Map.html” in
that directory.
If None, the map object will be returned instead.
- Returns:
Output path of the created HTML map or the map object itself.
- Return type:
pathlib.Path | folium.Map