python绘制五彩正五边形_python – 在folium中绘制带有地理数据帧的彩色多边形

不是专家……我刚刚开始使用folium和jupyter,并且有类似的问题,但是有了线条.

你说你有GeoJson和多边形,颜色包含在我认为的json中.

style_function可能会帮助你得到你想要的东西?

import folium

geoJsonData = {

"features": [

{

"geometry": {

"coordinates": [

[

12.98583984375,56.70450561416937

],[

14.589843749999998,57.604221411628735

],[

13.590087890625,58.15331598640629

],[

11.953125,57.955674494979526

],[

11.810302734375,58.76250326278713

]

],"type": "LineString"

},"properties": {

"stroke": "#fc1717","stroke-opacity": 1,"stroke-width": 2

},"type": "Feature"

},{

"geometry": {

"coordinates": [

[

14.9468994140625,57.7569377956732

],[

15.078735351562498,58.06916140721414

],[

15.4302978515625,58.09820267068277

],[

15.281982421875002,58.318144965188246

],[

15.4852294921875,58.36427519285588

]

],"properties": {

"stroke": "#1f1a95","type": "Feature"

}

],"type": "FeatureCollection"

}

m = folium.Map(location=[ 56.7,12.9],zoom_start=6)

folium.GeoJson(geoJsonData,style_function=lambda x: {

'color' : x['properties']['stroke'],'weight' : x['properties']['stroke-width'],'opacity': 0.6,'fillColor' : x['properties']['fill'],}).add_to(m)

m

希望这能带给你前进!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值