Folium-VectorTileLayer
VectorTileLayer plugin for Folium
Report Bug
·
Request Feature
Table of Contents
About The Project
Follow up on folium-vectorgrid that wraps Leaflet.VectorTileLayer to render Mapbox vector tiles in folium maps.
Other than Leaflet.VectorGrid, Leaflet.VectorTileLayer allows to "overzoom" and "underzoom". Even if the tiling provider only provides map tiles for zoom level 5 through 12, Leaflet.VectorTileLayer utilizes data from these upper and lower bounds to render tiles beyond zoom level 12 and 5 respectively.
Built With
Getting Started
Prerequisite
Install uv.
Installation
as dependency
poetry add git+https://github.com/iwpnd/folium-vectortilelayer.git
pip install folium-vectortilelayer
uv add folium-vectortilelayer
local development
- Clone and install
git clone https://github.com/iwpnd/folium-vectortilelayer.git uv sync
- Test it!
make test
Usage
from folium_vectortilelayer import VectorTileLayer
import folium
url = "https://free.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token=my_token"
m = folium.Map()
options = {
"layers": ["my_layer"], # define layer to be shown
# min zoom of your map,
# if minZoom < minDetailZoom features in minDetailZoom level are used
# for minDetailZoom to minZoom
"minZoom": 8,
# max zoom of your map,
# if maxZoom > maxDetailZoom features in maxDetailZoom level are used
# for maxDetailZoom to maxZoom
"maxZoom": 18,
# min zoom level provided by source
"minDetailZoom": 10,
# max zoom level provided by source
"maxDetailZoom": 13,
"vectorTileLayerStyles": {
"my_layer":{
"fill": True,
"weight": 1,
"fillColor": 'green',
"color": 'black',
"fillOpacity":0.6,
"opacity":0.6
},
}
}
vc = VectorTileLayer(url, "folium_layer_name", options)
m.add_child(vc)
m
Or with conditional styling
import folium
from folium_vectortilelayer import VectorTileLayer
m = folium.Map()
url = "https://free.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token=my_token"
options = '''{
"layers": ["my_layer"],
"vectorTileLayerStyles": {
"my_layer": function(f) {
if (f.type === 'parks') {
return {
"fill": true,
"weight": 1,
"fillColor": 'green',
"color": 'black',
"fillOpacity":0.6,
"opacity":0.6
};
}
if (f.type === 'water') {
return {
"fill": true,
"weight": 1,
"fillColor": 'purple',
"color": 'black',
"fillOpacity":0.6,
"opacity":0.6
};
}
}
}
}'''
VectorTileLayer(url,"layer_name",options).add_to(m)
m
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Benjamin Ramser - @imwithpanda - ahoi@iwpnd.pw
Project Link: https://github.com/iwpnd/folium-vector
Metadata
Release files for folium-vectortilelayer 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| folium_vectortilelayer-0.2.5.tar.gz | 77.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| folium_vectortilelayer-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 83.3 kB
Release files / folium_vectortilelayer-0.2.5.tar.gz
| Download URL | folium_vectortilelayer-0.2.5.tar.gz |
|---|---|
| Size | 77.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dabd35f1a536d7eb0c1d2b02633d2d64500a3975b274eda59ad3044b8c563157
|
|
BLAKE2b-256 checksum How to use checksums |
d4b912a313ffb119ffc37e8d8193bab1d1612e27180170094120e414b16810b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 17, 2025.
Transparency logRelease files / folium_vectortilelayer-0.2.5-py3-none-any.whl
| Download URL | folium_vectortilelayer-0.2.5-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b55d59cd07252e3103b504def9673a79bf4387b6e53601b9a0d313e5fcdbdf9f
|
|
BLAKE2b-256 checksum How to use checksums |
375560f32135cdde0c9136510c925fc88a6bfbd86e1ada271c023a58c5e7a6e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 17, 2025.
Transparency logSecurity for folium-vectortilelayer 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for folium_vectortilelayer-0.2.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 17, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.