🗺️ 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
Metadata
Release files for folium-pmtiles 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| folium_pmtiles-0.4.3.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| folium_pmtiles-0.4.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / folium_pmtiles-0.4.3.tar.gz
| Download URL | folium_pmtiles-0.4.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3ab8e3d21e59e1941cf90f4438d5d4a8bbae3b0135f544409e713e24fd9ae8e
|
|
BLAKE2b-256 checksum How to use checksums |
7a2110d1476ecbc5223e1af99f8fdee3d707b1a2a4a04a07197d6ceb53f21efa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.16 Darwin/23.1.0
|
Release files / folium_pmtiles-0.4.3-py3-none-any.whl
| Download URL | folium_pmtiles-0.4.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a5eb9c20d148f544dab3665134ac22081fb8c07f1cec7e9cdecd27a53b5008e
|
|
BLAKE2b-256 checksum How to use checksums |
c2ce65dfacfad9bcb4162ec18b3395fcc93c8db31592f8749c1fae005289eaae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.16 Darwin/23.1.0
|