문제 설명
Folium에서 특정 국가 강조 표시 (Highlight one specific country in Folium)
다음과 같이 폴리움으로 그린 지도가 있습니다.
m = folium.Map(location = [51.1657,10.4515], zoom_start=6, min_zoom = 5, max_zoom = 7)
이웃 국가를 제거하고 독일을 지켜? 또는 인접 국가가 흐려지거나, 흐려지거나, 창백해지거나 이와 유사한 현상이 나타납니다.
참조 솔루션
방법 1:
As long as you have a json file containing the geometry (coordinates) for the country of interest, you can add a GeoJson
layer:
import folium
import json
with open('datasets/world‑countries.json') as handle:
country_geo = json.loads(handle.read())
for i in country_geo['features']:
if i['properties']['name'] == 'Germany':
country = i
break
m = folium.Map(location = [51.1657,10.4515],
zoom_start=6,
min_zoom = 5,
max_zoom = 7)
folium.GeoJson(country,
name='germany').add_to(m)
folium.LayerControl().add_to(m)
m
and you get: