底图Shapefile可视化

底图Shapefile可视化,第1张

底图Shapefile可视化

我最近写了一篇有关使用basemap制作地图的博客文章,其中我使用shapefile在英格兰和威尔士的邮政编码区域进行绘制和着色。这可能会有帮助。http://www.jamalmoir.com/2016/06/creating-
map-visualisations-in-python.html

基本上,您可以使用shapefile创建一个PatchCollection,然后为PatchCollection着色。然后将其添加到地图中,鲍勃是您的叔叔。

m.readshapefile('data/uk_postpre_bounds/Areas', 'areas')df_poly = pd.Dataframe({        'shapes': [Polygon(np.array(shape), True) for shape in m.areas],        'area': [area['name'] for area in m.areas_info]    })df_poly = df_poly.merge(new_areas, on='area', how='left')cmap = plt.get_cmap('Oranges')   pc = PatchCollection(df_poly.shapes, zorder=2)norm = Normalize()pc.set_facecolor(cmap(norm(df_poly['count'].fillna(0).values)))ax.add_collection(pc)

在此示例中,我使用新房子的数量为每个区域着色,但是您可以做自己喜欢的事情。



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5667570.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存