Legend location in a DualMap
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- python
研究方向
首先在 folium 0.8.3 上執行提供的 DualMap 範例,並追蹤 DualMap、LayerControl 和 colormap 的 add_to 進入點。當每個地圖窗格只顯示其指派的圖例,且可以變更圖例位置時,即表示完成;報告中不點名任何 repository 檔案或測試。
由索引模型根據 Issue 內容生成。
描述
Please add a code sample or a nbviewer link, copy-pastable if possible
# Your code here
# Add Dual-basemap
m = folium.plugins.DualMap(location=target_city, zoom_start = 9, tiles= 'openstreetmap')
# layer definition
layer_1= folium.features.Choropleth(
geo_data= gjson
,name= 'column_1'
,key_on='feature.properties.postcode'
,data= zipcodes_geom
,columns= ['postcode', 'column_1']
,fill_color='YlGnBu'
,highlight=True
,legend_name='column_1'
)
# popup window
tooltip_1= folium.features.GeoJsonTooltip(['postcode', 'column_1'])
layer_1.geojson.add_child(tooltip_1) # add it to the layer
#===========================================================================
layer_2= folium.features.Choropleth(
geo_data= gjson
,name= 'column_2'
,key_on='feature.properties.postcode'
,data= zipcodes_geom
,columns= ['postcode', 'column_2']
,fill_color='BuPu'
,highlight=True
,legend_name='column_2'
)
# popup window
tooltip_2 = folium.features.GeoJsonTooltip(['postcode', 'column_2'])
layer_2.geojson.add_child(tooltip_2) # add to the layer
#=============================================================
# dual map
# fg_both = folium.FeatureGroup(name='postcode_both').add_to(m)
fg_1= folium.FeatureGroup(name='column_1').add_to(m.m1)
fg_2= folium.FeatureGroup(name='column_2').add_to(m.m2)
layer_1.geojson.add_to(fg_1)
layer_2.geojson.add_to(fg_2)
# adding figure 1 and 2 to the basemap
fg_1.add_to(m.m1)
fg_2.add_to(m.m2)
#===========================
# add Layer control to Dual basemapa
# add legend for layer 1
folium.LayerControl(collapsed=True).add_to(m)
colormap_1= cm.linear.YlGnBu_06.scale(0,180)
colormap_1= colormap_1.to_step(index=[0,30,60,90,120,150,180])
colormap_1.caption= 'column_1'
colormap_1.add_to(m.m1)
# add legend for layer 2
colormap_2= cm.linear.PuBu_06.scale(0,180)
colormap_2= colormap_2.to_step(index=[0,14,29,43,58,72,87])
colormap_2.caption= 'column_2'
colormap_2.add_to(m.m2)
#===========================
# display map
display(m)
Problem description
Creating a Dual Map with two different geojson:
At the moment of adding the legends to the basemap (m), if I add one legend and define where to locate it could be grid 1(m.m1) or grid 2(m.m2) "It Works fine", but if I add the second legend, they get stack one on top of other, no mater that I assigned them to a different grid.
Also, It's there a way to move the legend to a different position in the basemap?
Expected Output
Would be that each grid of the Dual Map (basemap) contain one geojson and one legend.
Output of folium.__version__
0.8.3
- 主要語言
- Python
- 星號
- 7.4k
- 分支
- 2.3k
- 平均合併
- 2 天 4 小時
- 30 天內合併 PR
- 10
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
python-visualization/folium 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
python-visualization/folium#2293 · 2 則留言 ·
維護者通常 1 天內回覆
-
Make it more obvious how to add text可能已有人在做 @mosessamofficial-sys 於 228 天前認領。 未關閉documentation
難度 2/5 1-3 小時 新手友好度 68/100
python-visualization/folium#2092 · 5 則留言 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 25/100
python-visualization/folium#2259 ·
維護者通常 1 天內回覆
-
Map output from OSM returns blocked tiles, due to defective request or not following referer-policy未關閉
難度 3/5 1-2 天 新手友好度 55/100
python-visualization/folium#2236 · 8 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 10/100
python-visualization/folium#2219 · 2 則留言 ·
維護者通常 1 天內回覆
查看 python-visualization/folium 的全部 Issue
相似的 Issue
-
docs pydanty:is-working
難度 2/5 1-3 小時 新手友好度 68/100
pydantic/pydantic-ai#10113 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
GreedyBear-Project/GreedyBear#1727 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
ARM-software/CMSIS-DSP#354 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
kiat/codeAssist#391 ·
-
needs triage
難度 2/5 1-3 小時 新手友好度 83/100
darnitdevorg/darnit#587 ·
維護者通常 1 天內回覆