R函数中的错误readGPS:找不到gpsbabel
问题描述:
我试图从YOURS路由API(http://wiki.openstreetmap.org/wiki/YOURS#Routing_API)下载gpx文件并使用maptools包中包含的readGPS函数将文件上传到R中。R函数中的错误readGPS:找不到gpsbabel
下面是代码:
require(utils)
require(maptools)
URL <- 'http://www.yournavigation.org/api/1.0/saveas.php?type=gpx&data=5.62373%2053.01,5.62359%2053.01014,5.62336%2053.01024,5.62314%2053.010303'
download.file(URL, 'tmpTrip.gpx')
gpx.raw <- readGPS(i='gpx', f='tmpTrip.gpx', type='t')
我收到的错误:
Error in readGPS(i = "gpx", f = "tmpTrip.gpx", type = "t") :
gpsbabel not found
我已经安装了gpsbabel,我可以看到GPX文件在我的工作目录正确下载。 我的系统和R版本是: Windows 7 Enterprise Service Pack 1,运行在Intel Core i5-3320M CPU @ 2.60GHz,4GB RAM,32位操作系统上。
R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
任何帮助非常感谢,谢谢!
答
找出困难的方法,我发现readGPS()
调用Sys.which
这是一个函数,它试图找到文件位于系统上的位置。 ?Sys.which
没有说清楚,但(至少在Windows上)它的工作,你需要添加gpsbabel的安装路径到你的路径。