获取主要城市所有交叉路口列表的最佳来源和方式是什么?
maps google-maps openstreetmap google-places-api google-places
我正在寻找一种从OpenStreetMap(OSM)数据中准确检索街道交叉点的方法.我知道提出并回答了类似的问题,但我可以从建议的方法中检索的数据不是很准确.
首先,我知道以下问题:
上述问题的答案表明:
"查询给定边界框中的所有方式,并查找由两个或多个方式共享的节点,如另一个答案中所述."
我按照这个建议编写了一个python脚本,它从我从OpenStreetMap下载的xml文件(osm文件)中提取节点元素.以下是代码:
try:
from xml.etree import cElementTree as ET
except ImportError, e:
from xml.etree import ElementTree as ET
def extract_intersections(osm, verbose=True):
# This function takes an osm file as an input. It then goes through each xml
# element and searches for nodes that are shared by two or more ways.
# Parameter:
# - osm: An xml file that contains OpenStreetMap's map information
# - verbose: If true, print some …Run Code Online (Sandbox Code Playgroud)