我正在尝试提取 OSRM 数据但遇到麻烦。在上一个问题(尝试提取 osrm 数据时 lua error)中,我遇到了错误。所以除了 Docker 之外,我不会尝试做同样的事情。我正在使用带有硅芯片的较新 Mac。我首先安装了 Docker(https://docs.docker.com/desktop/install/mac-install/;然后在终端中docker pull osrm/osrm-backend)。我从https://download.geofabrik.de/north-america.html下载北美数据。我为实例分配了 50GB 内存以及几个核心。如果在终端中运行,docker run -t -v /Users/[name]/osrm-backend/docker:/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/north-america-latest.osm.pbf我会得到:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
[info] Parsed 0 location-dependent features with 0 GeoJSON polygons
[info] Using script /opt/car.lua
[info] Input file: north-america-latest.osm.pbf
[info] Profile: car.lua
[info] Threads: 5
[info] Parsing in …Run Code Online (Sandbox Code Playgroud) 我已经在桌面上下载了OpenStreetMap文件,并在jupyter笔记本中使用了OSM文件。
我的代码:
import xml.etree.cElementTree as ET
osm_file = "ahmedabad_india.osm"
for event, elem in ET.iterparse(osm_file, events=("start",)):
print(elem)
# prints the Element 'osm' at 0x03A7DC08>
#<Element 'bounds' at 0x03A7DDA0>
#<Element 'node' at 0x03A7DE90>
#<Element 'tag' at 0x03A7DF08> and so on ...
Run Code Online (Sandbox Code Playgroud)
我想查看所有tagsie
<'node', 'id', 'name', ...>等的内容。
我尝试使用elem标签,但没有打印任何内容。
任何人都可以帮助我找出谁来获取标记的内容,例如节点,方式等。