首页 > 解决方案 > 集成 osmosis 和 python 从 .osm 文件中获取数据

问题描述

我正在尝试使用 python 脚本从 .osm 文件中过滤数据

以下是我为此目的使用的 python 代码。但是创建的 .osm 文件不包含输入文件中的数据。

import subprocess

subprocess.call(['C:/Users/91957/Desktop/osmosis/bin/osmosis.bat','--read-xml','C:/Users/91957/Desktop/osm_test/Sample_input.osm',
                 '--nkv','keyValueList="amenity.fast_food"','--write-xml','C:/Users/91957/Desktop/osm_test/fast_food.osm'])

但是当在命令行上运行以下命令时,它就像魅力一样。

osmosis --read-xml file=Sample_input.osm --nkv keyValueList="amenity.fast_food" --write-xml file=fast_food.osm

标签: pythonsubprocessopenstreetmaposmosis

解决方案


推荐阅读