Skip to content

geohierarchy.maps.folium.basemap

Basemap presets and helpers for building the map background (MapLibre vector style or raster XYZ).

build_tile_layer(basemap)

Build the background layer from a preset name, dict, or passthrough instance.

Presets starting with openfreemap_ (or a dict with a style URL) give a MapLibre vector-tile background (a :class:MapLibreBasemap); the rest are raster folium.TileLayers.

Parameters:

Name Type Description Default
basemap Union[str, dict, Any]

One of: a preset name (key of :data:BASEMAPS), a folium.TileLayer instance (returned unchanged), or a dict with tiles/attr/name/max_native_zoom (and optionally subdomains) describing a custom XYZ provider.

required

Returns:

Type Description

A folium.TileLayer configured with max_zoom=25 on the map

side and the provider's real max_native_zoom, so Leaflet

upscales tiles beyond what the provider natively serves.

Raises:

Type Description
KeyError

If basemap is a string not present in BASEMAPS.

TypeError

If basemap is not a recognized type.