栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

osmnx 应用 可视化两张图异同的点和边

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

osmnx 应用 可视化两张图异同的点和边

python 包介绍:osmnx_UQI-LIUWJ的博客-CSDN博客

0 数据描述

假设我们现在有这样两个graph:(需要import osmnx as ox)

point1=(31.191184,121.516295)
G1=ox.graph_from_point(point1,dist=2000)
ox.plot_graph(G1)

 

point2=(31.191469,121.48904)
G2=ox.graph_from_point(point2,dist=2000)
ox.plot_graph(G2)

 

1 在G1中可视化一下哪些边是G1和G2都有的,哪些只有G1有

 

edge_color_lst=[]
for i in G1.edges():
    if i in G2.edges:
        edge_color_lst.append('green')
    else:
        edge_color_lst.append('red')
ox.plot.plot_graph(G1,edge_color=edge_color_lst,figsize=(100,25))

 

 2 点同理
nodes_color_lst=[]
for i in G1.nodes():
    if i in G2.nodes:
        nodes_color_lst.append('green')
    else:
        nodes_color_lst.append('red')
ox.plot.plot_graph(G1,node_color=nodes_color_lst)

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/619143.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号