sk5106
sk5106

Reputation: 11

Folium adding an overlay (.geojson) to map

This is what I have so far:

import folium

m = folium.Map(
        location=[43.761539, -79.411079],
        tiles="Stamen Toner",
        zoom_start=11
        )

m.save("index.html")

folium.GeoJson("file.geojson").add_to(m)
m

Up until the folium.GeoJson... line the map shows up but the overlay makes nothing render

Upvotes: 1

Views: 2115

Answers (1)

sentence
sentence

Reputation: 8913

You need to add a LayerControl():

import folium

m = folium.Map(
        location=[43.761539, -79.411079],
        tiles="Stamen Toner",
        zoom_start=11
        )

folium.GeoJson("file.geojson", name="geojson").add_to(m)

folium.LayerControl().add_to(m)

m.save("index.html")
m

Upvotes: 2

Related Questions