Skip to content
Discussion options

You must be logged in to vote

It depends on what the .pbf file is. Folium (Leaflet) displays map tiles, not raw map data, so you have two different cases:

Case 1: it's a vector tile (.pbf from a {z}/{x}/{y}.pbf tile URL)
A single tile only covers one small square at one zoom level, so it's not very useful on its own. For a whole area, use an .mbtiles file, serve it locally, and render it with the VectorGrid plugin:

pip install folium-vectorgrid
import folium
from folium_vectorgrid import VectorGridProtobuf

m = folium.Map(location=[48.85, 2.35], zoom_start=12, tiles=None)
VectorGridProtobuf("http://localhost:8080/data/v3/{z}/{x}/{y}.pbf", "my-tiles", {}).add_to(m)
m.save("map.html")

(You can serve the .mbtiles with e.g.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MaxWindsor
Comment options

@MaxWindsor
Comment options

@MaxWindsor
Comment options

Answer selected by MaxWindsor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants