地理空间数据处理:矢量分析与空间参考系统
1. 矢量分析
在地理空间数据处理中,矢量分析是一项重要的工作。以计算信天翁每次访问岛屿所使用的总面积比例为例,以下是具体的代码实现:
ds = ogr.Open(r'D:\osgeopy-data\Galapagos')
lyr = ds.GetLayerByName('albatross_ranges2')
lyr.SetAttributeFilter("tag_id = '1163-1163' and location = 'island'")
row = next(lyr)
all_areas = row.geometry().Clone()
common_areas = row.geometry().Clone()
for row in lyr:
all_areas = all_areas.Union(row.geometry())
common_areas = common_areas.Intersection(row.geometry())
percent = common_areas.GetArea() / all_areas.GetArea() * 100
print('Percent of all area used in every visit: {0}'.format(percent))
运行该代码后,输出结果如下:
Percent of all area used in every visit: 25.1565197202
从结果来看,这只信天翁每
超级会员免费看
订阅专栏 解锁全文
5277

被折叠的 条评论
为什么被折叠?



