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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file folium_pmtiles-0.4.3.tar.gz.
File metadata
- Download URL: folium_pmtiles-0.4.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.16 Darwin/23.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3ab8e3d21e59e1941cf90f4438d5d4a8bbae3b0135f544409e713e24fd9ae8e
|
|
| MD5 |
1c104a45a596ef1b9f8c315f1767ac63
|
|
| BLAKE2b-256 |
7a2110d1476ecbc5223e1af99f8fdee3d707b1a2a4a04a07197d6ceb53f21efa
|
File details
Details for the file folium_pmtiles-0.4.3-py3-none-any.whl.
File metadata
- Download URL: folium_pmtiles-0.4.3-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.16 Darwin/23.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a5eb9c20d148f544dab3665134ac22081fb8c07f1cec7e9cdecd27a53b5008e
|
|
| MD5 |
7805938dedc4844ffab925697f83fd99
|
|
| BLAKE2b-256 |
c2ce65dfacfad9bcb4162ec18b3395fcc93c8db31592f8749c1fae005289eaae
|