【发布时间】:2018-04-06 10:28:44
【问题描述】:
我已经下载了一个 openstreetmap shapefile,并且想要提取某些特征(以使文件不那么重,并且只包含我感兴趣的那些,例如道路上的自行车道)。我将如何做到这一点,我目前可以打开文件并使用此代码查看功能:
from osgeo import ogr
file = ogr.Open('gis.osm_roads_free_1.shp')
shape = file.GetLayer(0)
# here I want to filter on an "fclass" value
关于如何做到这一点的任何建议?
【问题讨论】:
-
什么是 fclass?一个属性?
-
shapefile 的布局如何?是每层一个特征,您想要迭代层还是想要迭代第 0 层中的特征?
-
fclass确实是一个属性,它包含了道路的类型(例如:高速公路、主干道、自行车道等)。 shapefile 只有一层,在该层中具有特征(道路线)。
标签: python gis openstreetmap gdal ogr