获取列表在OSM文件的街道名称

获取列表在OSM文件的街道名称
发布日期: 2016-10-06 更新日期: 1970-01-01 编辑:yubiao 浏览次数: 2864

标签:
 import ogr

ds = ogr.Open('map.osm')
layer = ds.GetLayer(1) # layer 1 for ways

nameList = []
for feature in layer:
    if feature.GetField("highway") != None:  # only streets
        name = feature.GetField("name")
        if name != None and name not in nameList: # only streets that have a name and are not yet in the list
            nameList.append(name)

print nameList
说明:

这个方法需要在OSM文件和打印列表文件中的所有街道的名字。


Copyright © Since 2014. 开源地理空间基金会中文分会 吉ICP备05002032号

Powered by TorCMS

OSGeo 中国中心 邮件列表

问题讨论 : 要订阅或者退订列表,请点击 订阅

发言 : 请写信给: osgeo-china@lists.osgeo.org