geohierarchy.maps.maplibre¶
MapLibre GL JS rendering for HierarchyMap, at Folium base-layer parity.
See :mod:geohierarchy.maps.maplibre.render for :class:MapLibreHierarchyMap.
MapLibreHierarchyMap(hmap)
¶
Renders an already-built :class:HierarchyMap via MapLibre GL JS + PMTiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hmap
|
HierarchyMap
|
A :class: |
required |
build_html(basemap=DEFAULT_BASEMAP, title='Map')
¶
Return the complete self-contained MapLibre HTML document (as a string).
The PMTiles pmtiles:// protocol is registered via
maplibregl.addProtocol per the user's spec; tile URLs are
relative to the output HTML file's own directory (same convention
Folium's output uses), so this HTML must be saved next to
hmap.tiles_dir (see :meth:save).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basemap
|
Union[str, Dict[str, Any]]
|
Basemap name or spec. |
DEFAULT_BASEMAP
|
title
|
str
|
Page title. |
'Map'
|
save(path, basemap=DEFAULT_BASEMAP, title='Map')
¶
Write the MapLibre HTML to path.
path must be a sibling of hmap.tiles_dir (same directory),
matching the relative pmtiles://<tiles_dir_name>/<level>.pmtiles
URLs baked into the generated HTML -- exactly the convention
Folium's own HierarchyMap.save() output already relies on for
its XYZ tile URLs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
HTML file to write, next to |
required |
basemap
|
Union[str, Dict[str, Any]]
|
Basemap name or spec. |
DEFAULT_BASEMAP
|
title
|
str
|
Page title. |
'Map'
|
Returns:
| Type | Description |
|---|---|
str
|
The written path. |
save_maplibre(hmap, path, basemap=DEFAULT_BASEMAP, title='Map')
¶
Convenience wrapper: save_maplibre(hmap, "map_maplibre.html").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hmap
|
HierarchyMap
|
A built :class: |
required |
path
|
str
|
HTML file to write. |
required |
basemap
|
Union[str, Dict[str, Any]]
|
Basemap name or spec. |
DEFAULT_BASEMAP
|
title
|
str
|
Page title. |
'Map'
|
Returns:
| Type | Description |
|---|---|
str
|
The written path. |