Folium Plugin to Support PMTiles
Project description
🗺️ Folium Plugin to support PMTiles
Basic usage
Installation
pip install folium folium-pmtiles
Usage
The recommend way is to use PMTilesVector
. This converts a simple mapbox style to a appropriate leaflet/protomaps styles.
If you need more complex styling, you can use PMTilesMapLibreLayer
A simple folium example is as follows:
import folium
from folium_pmtiles.vector import PMTilesVector
m = folium.Map(location=[43.7798, 11.24148], zoom_start=12)
pmtiles_layer = PMTilesVector(
"https://pmtiles.jtmiclat.me/protomaps(vector)ODbL_firenze.pmtiles",
"folium_layer_name",
style={
"layers": [
{
"source-layer": "landuse",
"type": "fill",
"paint": {"fill-color": "steelblue"},
},
{
"source-layer": "roads",
"type": "line",
"paint": {"line-color": "black"},
},
],
},
options={
"attribution": """<a href="https://protomaps.com">Protomaps</a> © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'"""
},
)
m.add_child(pmtiles_layer)
See example/ to see more examples and live demos via google collab or github.dev.
Dev Setup
poetry install --with dev
poetry run pre-commit install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
folium_pmtiles-0.4.2.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for folium_pmtiles-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62d4bc2e8b7d170d07b0341a5913fafe713e097f99f31b78ce23a85399a3d075 |
|
MD5 | 43c5f2ec73a32b6805555591f113114b |
|
BLAKE2b-256 | abc29f88d9ba298b3047a08b7e2d1a3f8a3697848702c5c3637d83ed54e85c9b |