0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

folium コロプレス図 + MakerCluster + Makerの共存

Last updated at Posted at 2025-06-25
コード
import folium
import json
from folium import plugins

# 市町村境界データの読み込み
f = open("./N03-190101_34_GML/N03-19_34_190101.geojson", 'r', encoding='utf-8_sig')
geojson = json.load(f)
f.close()

# マップの作成
map_center = [34.396528, 132.459592]
m = folium.Map(location=map_center, zoom_start=7)

# コロプレス図を追加
folium.Choropleth(
    name='choropleth',
    geo_data=geojson,
    nan_fill_color='white',
    fill_opacity=0.0,
    nan_fill_opacity=0.2,
    line_opacity=0.5,
).add_to(m)

# Makerを追加
folium.Marker(location=[34.396528, 132.459592], icon=folium.Icon(icon="info-sign",icon_color="white", color="blue")).add_to(m) 

# MakerClusterを追加
marker_cluster = plugins.MarkerCluster().add_to(m) 
folium.Marker([34.1, 132.1], popup="Clustered Marker 1").add_to(marker_cluster)
folium.Marker([34.2, 132.2], popup="Clustered Marker 2").add_to(marker_cluster)

m.save('Hiroshima.html')
市区町村境界データ

image.png

Hiroshima.html

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?