VectorTileLayer plugin for folium
Project description
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
Project details
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_vectortilelayer-0.2.5.tar.gz.
File metadata
- Download URL: folium_vectortilelayer-0.2.5.tar.gz
- Upload date:
- Size: 77.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dabd35f1a536d7eb0c1d2b02633d2d64500a3975b274eda59ad3044b8c563157
|
|
| MD5 |
636385b2118de63a52b982ffc809fea2
|
|
| BLAKE2b-256 |
d4b912a313ffb119ffc37e8d8193bab1d1612e27180170094120e414b16810b2
|
Provenance
The following attestation bundles were made for folium_vectortilelayer-0.2.5.tar.gz:
Publisher:
main.yml on iwpnd/folium-vectortilelayer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
folium_vectortilelayer-0.2.5.tar.gz -
Subject digest:
dabd35f1a536d7eb0c1d2b02633d2d64500a3975b274eda59ad3044b8c563157 - Sigstore transparency entry: 214501358
- Sigstore integration time:
-
Permalink:
iwpnd/folium-vectortilelayer@e903d728f36ed9a3510d7f30472d97594d1d209e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/iwpnd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@e903d728f36ed9a3510d7f30472d97594d1d209e -
Trigger Event:
push
-
Statement type:
File details
Details for the file folium_vectortilelayer-0.2.5-py3-none-any.whl.
File metadata
- Download URL: folium_vectortilelayer-0.2.5-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b55d59cd07252e3103b504def9673a79bf4387b6e53601b9a0d313e5fcdbdf9f
|
|
| MD5 |
7e7c338915d36881dc68bc3803ccb49c
|
|
| BLAKE2b-256 |
375560f32135cdde0c9136510c925fc88a6bfbd86e1ada271c023a58c5e7a6e5
|
Provenance
The following attestation bundles were made for folium_vectortilelayer-0.2.5-py3-none-any.whl:
Publisher:
main.yml on iwpnd/folium-vectortilelayer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
folium_vectortilelayer-0.2.5-py3-none-any.whl -
Subject digest:
b55d59cd07252e3103b504def9673a79bf4387b6e53601b9a0d313e5fcdbdf9f - Sigstore transparency entry: 214501360
- Sigstore integration time:
-
Permalink:
iwpnd/folium-vectortilelayer@e903d728f36ed9a3510d7f30472d97594d1d209e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/iwpnd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@e903d728f36ed9a3510d7f30472d97594d1d209e -
Trigger Event:
push
-
Statement type: