Summary
geopandas의explore()메서드와folium라이브러리를 활용하여 인터랙티브 지도를 시각화할 수 있다.- Vworld 배경지도 URL을
tiles파라미터로 설정하면 국내 지도 배경을 적용할 수 있다.
explore (Geopandas)
explore
- Geopandas 내
explore()메서드 활용folium,matplotlib,mapclassify패키지 설치 필요- 속성정보도 함께 표시되며 HTML로 저장 가능
# Vworld 배경지도 활용하여 HTML로 저장
gdf.explore(
column='color',
legend=False,
tiles='https://xdworld.vworld.kr/2d/Base/service/{z}/{x}/{y}.png',
attr='vworld'
).save('../data/total.html')folium
배경지도 (tiles)
커스텀 지도 제작 시,
attr로 배경지도 저작권 표시 필수!
기본 제공 배경지도:
OpenStreetMap(기본값)Stamen Terrain,Stamen Toner,Stamen WatercolorCartoDB positron,CartoDB dark_matter
커스텀 배경지도 (Vworld):
tiles='https://xdworld.vworld.kr/2d/Base/service/{z}/{x}/{y}.png'
attr='vworld'예시 코드
import geopandas as gpd
import folium
# GeoDataFrame 생성 후 지도 시각화
gdf.explore(
column='color',
legend=False,
tiles='https://xdworld.vworld.kr/2d/Base/service/{z}/{x}/{y}.png',
attr='vworld'
).save('../data/total.html')Reference