你的 R 重启了吗?看起来渗透不在您的路径中,尽管您确实提到您设置了它。确保您可以在终端中运行渗透命令之一:
osmosis --read-xml SloveniaGarmin.osm --tee 4 --bounding-box left=15 top=46 --write-xml SloveniaGarminSE.osm --bounding-box left=15 bottom=46 --write-xml SloveniaGarminNE.osm --bounding-box right=15 top=46 --write-xml SloveniaGarminSW.osm --bounding-box right=15 bottom=46 --write-xml SloveniaGarminNW.osm
这个例子无关紧要,只要它没有说osmosis file not found。
另外,请确保您的路径中有 gzip。我几乎可以肯定它是默认的,但 demo 包依赖它来运行。只需打开终端并输入 gzip 以确保它在那里。
最后,如果你需要调试这个,那么运行这个:
library(osmar)
download.file("http://osmar.r-forge.r-project.org/muenchen.osm.gz","muenchen.osm.gz")
system("gzip -d muenchen.osm.gz")
# At this point, check the directory listed by getwd(). It should contain muenchen.osm.
src <- osmsource_osmosis(file = "muenchen.osm",osmosis = "osmosis")
muc_bbox <- center_bbox(11.575278, 48.137222, 3000, 3000)
debug(osmar:::get_osm_data.osmosis)
get_osm(muc_bbox, src)
# Press Enter till you get to
# request <- osm_request(source, what, destination)
# Then type request to get the command it is sending.
在您输入一次 Enter 后,然后输入 request,您将获得它发送到您的操作系统的字符串。它应该是这样的:
osmosis --read-xml enableDateParsing=no file=muenchen.osm --bounding-box top=48.1507120588903 left=11.5551240885889 bottom=48.1237319411097 right=11.5954319114111 --write-xml file=<your path>
尝试将其粘贴到您的终端中。它应该适用于任何目录。
哦,输入undebug(osmar:::get_osm_data.osmosis) 停止调试。输入Q 退出调试器。