python - 具有分组要素图层控制的时间戳 geojson
问题描述
我想用时间戳信息可视化地理数据。我在我的 python 代码中使用 plugins.TimestampedGeoJson 来做到这一点。代码实际上是有效的,但我需要在地图中显示超过 1 个功能,并且这些功能中的每一个都可以从 LayerControl 显示/隐藏。
有什么想法吗?
#example 具有一项功能
features_3 = []
for row in DF_3.itertuples():
long = row.longitude
lat = row.latitude
data= row.data
features_3 .append (
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [long,lat],
},
"properties": {
"time": str(row.xdate),
"popup": "Record : " + str(data) ,
"icon": "circle",
"iconstyle": {
"fillColor": color_scale(data),
"fillOpacity": 0.6,
"stroke": "false",
"radius": 8,
},
"style": {"weight": 0},
},
}
)
plugins.TimestampedGeoJson(
{"type": "FeatureCollection", "features": features_3 },
period="P1D",
add_last_point=True,
auto_play=True,
loop=False,
max_speed=1,
loop_button=True,
time_slider_drag_update=True,
duration="P1D",
).add_to(map)
LayerControl().add_to(map)
解决方案
TimestampedGeoJson 持续时间参数导致多边形消失
此链接中的代码可能会对您有所帮助。您可以看到它是如何在同一张地图中添加多个多边形图层的。
推荐阅读
- angular - 如何识别表单组中的哪个属性发出了 valuechanges 事件
- html - div背景颜色过渡不起作用
- firebase - 没有为“Firestore”类型定义吸气剂“实例”
- junit - 使用 taurus junit-xml 模块时请求响应数据
- java - 如何计算二进制中零的数量?
- swift - 完成多项选择后如何启用按钮以及如何禁用其他选择?
- java - 在 Java 中使用 Python Pickle 对象
- r - 如何在 R 中选择名称中带有 UTF-8 符号的列?
- twilio - Twilio 传真受保护资产
- node.js - dockerizing nodejs 应用程序 - 当我第一次启动容器时 pm2 ls 应该工作吗