python - 如何设置geojson的样式?
问题描述
我的输入是一个 shapefile,我正在尝试根据不同的 Traveltime 保存我的数据的颜色代码。
我可以传递数据并保存为 html,但它似乎没有为我的数据着色。
gjson=isochrone.to_crs(epsg='4326').to_json()
iso=json.loads(gjson)
map_Baseline=folium.Map(location=[52.486044, -1.892751],zoom_start=12)
folium.GeoJson(iso,
name='geojson',
style_function= lambda x :{
'fillcolor': (
'green' if x['properties']['Traveltime'] == '10800'
else 'orange' if '7800' == x['properties']['Traveltime'] == '5400'
else 'red'},
).add_to(map_Baseline)
folium.LayerControl(iso).add_to(map_Baseline)
map_Baseline.save("map.html")
有任何想法吗?谢谢
解决方案
推荐阅读
- smalltalk - 在 GNU Smalltalk 中使用和不使用“new”创建的实例之间的区别
- c# - 如何修复错误“'3/23/2019 12:00:00 AM'的值对'Value'无效。'Value'应介于'MinDate'和'MaxDate'之间。”
- emacs - 如何将 SPC-bb 或 SPC-pb 映射到像 ä,ö,ü 这样的变音符号
- java - 扫描仪总是需要两个输入(Java)
- python - 如何使用我分配的键绑定移动我的精灵?
- c# - 如何“将 .XML 数据显示到 listView1 的每一列”?C# Windows 窗体
- git - Git:如何压缩“master”分支上的所有提交?
- google-sheets - Google 电子表格数据库导入错误:无法保存 ID 为 [--ID--] 的文档:文档太大
- java - 标准对话框按钮样式到 JFoenix
- excel - 如何使用分配给按钮的代码将隐藏在表格底部一行中的公式复制到位于同一列中的活动单元格?