政令指定都市の Topojson の一覧 の続きです。
前回 作った一覧を使って 政令指定都市の形を描画する
一覧を forループで処理する。 政令指定都市ごとに地図を作成する。 都道府県の形も描画する。 行政区の形も描画する。
都道府県と 行政区の GeoJsonは、下記を使用した。
for item1 in list_designated_cities: pref_name = item1['N03_001'] city_name = item1['N03_003'] filepath = item1['filepath'] name = item1['name'] lat = item1['lat'] lon = item1['lon'] url_topojson = urllib.parse.urljoin(url_designated_base, filepath) is_match, url_pref_geojson = find_pref(pref_name) print(city_name) title_html = FORMAT_TITLE.format(pref=pref_name, city=city_name) file_html = FORMAT_FILE_HTML.format(dir=DIR, name=name) # Map map = folium.Map(location=[lat, lon], tiles="cartodbpositron", zoom_start=ZOOM) # GeoJson 都道府県 gjson1 = folium.GeoJson( url_pref_geojson, style_function=style_function_blue).add_to(map) # GeoJsonPopup folium.features.GeoJsonPopup( fields=['name'], labels=False ).add_to(gjson1) # TopoJson 政令指定都市 folium.TopoJson( json.loads(requests.get( url_topojson).text), object_path = OBJECT_PATH, style_function=style_function_red).add_to(map) map.save(file_html) #
https://github.com/ohwada/World_Countries/tree/main/geojson/folium/japan_designated_city_shape