首页 > 编程知识 正文

arcgis路网分析,arcgis路网密度分析

时间:2023-05-05 06:48:41 阅读:253966 作者:4193

ArcGIS 相交

利用ArcGIS里面的相交工具,每个省把路标识了。

计算几何

分别计算路网的长度和各省的面积。

Python

利用Python对属性数据进行处理

导入相关模块 ## 导入相关模块import pandas as pdimport geopandas as gpdimport matplotlib.pyplot as plt%matplotlib inline 解决中文乱码 plt.rcParams['font.family'] = ['sans-serif']plt.rcParams['font.sans-serif'] = ['SimHei']# 替换sans-serif字体为黑体plt.rcParams['axes.unicode_minus'] = False # 解决坐标轴负数的负号显示问题 数据读取 regibns = gpd.GeoDataFrame.from_file("省级行政区.shp")regibns = regibns[["NAME","AREA","geometry"]]regibns["AREA"] = regibns["AREA"]/1000000regibns.head()regibns.plot()

road = gpd.GeoDataFrame.from_file("道路密度.shp")road.head() road = road[["NAME", "length", "geometry"]]road.plot()

数据透视 pivot = pd.pivot_table(road, index="NAME",values="length",aggfunc=sum)pivot.head() 数据连接 results = pd.merge(regibns, pivot, on="NAME")results["Density"] = results["length"] / results["AREA"]results.head()

数据可视化 data_geod = gpd.GeoDataFrame(results)data_geod['coords'] = data_geod['geometry'].apply(lambda x: x.representative_point().coords[0])data_geod.plot(figsize=(12, 12), column='Density', scheme='quantiles', legend=True, cmap='Reds', edgecolor='k')for n, i in enumerate(data_geod['coords']): plt.text(i[0], i[1], data_geod['NAME'][n], size=12)plt.title('中国各省主要公路密度图', size=25)plt.grid(True, alpha=0.3)

总结和反思

因为arcpy只支持python2,我用ArcGIS Pro的python3,也没有geopandas模块,所以在两个软件切换了。在ArcGIS中注意坐标系,我们计算面积和长度都是在投影坐标系下进行的。还有那个大神可以告诉我geopandas里面我的线图层和面图层怎么叠加,就是在这个底图的基础上加入路网图层。

补充高阶函数历史中提交的图片或压缩文件

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。