Search code examples
pythonjsongeocodinggeojsonfolium

How to load GeoJson file properly?


I have a geojson file of Moscow districts that is avaliable at

http://gis-lab.info/data/mos-adm/mo.geojson

So, I can't load it properly.

These ideas does not help:

I tried to create a map and then add a layer on it.

 import folium

m = folium.Map(location = [55.7522200,37.6156000], zoom_start_13)

folium.GeoJson(open('mo.geojson')).add_to(m)'

this does not work


Solution

  • Try folium.GeoJson(open('mo.geojson').read()).add_to(m)

    This reads the contents of the file and passes the string to folium.