455 KiB
455 KiB
In [1]:
%load_ext autoreload %autoreload 2
In [4]:
import sys sys.path.append('../') import json from stimmen.latitude_longitude import reverse_latitude_longitude import folium from stimmen.cbs import get_available_provinces, province_geojson from shapely.geometry import shape import folium from IPython.display import display
In [5]:
for province in ['Groningen', 'Friesland', 'Zeeland']: center = shape(province_geojson(province, with_water=True)['geometry']).centroid m = folium.Map((center.y, center.x), tiles='stamentoner', zoom_start=9) with open('../data/{}_gemeentes.geojson'.format(province), 'r') as f: gemeentes = json.load(f) with open('../data/{}_wijken.geojson'.format(province), 'r') as f: wijken = json.load(f) for feature in wijken['features']: coordinates = reverse_latitude_longitude(feature['geometry']['coordinates']) polygon = folium.Polygon(coordinates, fill_color=None, color='blue').add_to(m) for feature in gemeentes['features']: coordinates = reverse_latitude_longitude(feature['geometry']['coordinates']) polygon = folium.Polygon(coordinates, fill_color=None, color='red').add_to(m) print(province) display(m)
Groningen
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-5-4015368e13b0> in <module>() 4 m = folium.Map((center.y, center.x), tiles='stamentoner', zoom_start=9) 5 ----> 6 with open('../data/{}_gemeentes.geojson'.format(province), 'r') as f: 7 gemeentes = json.load(f) 8 with open('../data/{}_wijken.geojson'.format(province), 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: '../data/Friesland_gemeentes.geojson'