我想计算大约之间的距离。 100,000 个不同的邮政编码。我知道 mapdist
ggmap
中的函数包裹mapdist
完美运行:
library(ggmap)
mapdist('Washington', 'New York', mode = 'driving')
# from to m km miles seconds minutes hours
# 1 Washington New York 366284 366.284 227.6089 13997 233.2833 3.888056
mapdist('20001', '10001', mode = 'driving')
# from to m km miles seconds minutes hours
# 1 20001 10001 363119 363.119 225.6421 13713 228.55 3.809167
然而,
mapdist
依赖于受 约束的 Google Geocoding API查询限制为 2,500 个地理定位请求 每天。您是否知道使用具有更高请求限制的其他服务(例如诺基亚 map 或必应)来计算两点之间距离的任何替代代码?
最佳答案
taRifx.geo::georoute
(只有 here 可用,直到我推出另一个更新,届时它将通过 install.packages
可用)可以使用 Bing map (我相信它支持每天 25k)并且可以返回一个距离。
georoute( c("3817 Spruce St, Philadelphia, PA 19104",
"9000 Rockville Pike, Bethesda, Maryland 20892"),
verbose=TRUE, returntype="time",
service="bing" )
您必须获得 Bing Maps API key 并将其设置在 R 全局选项中(理想位置在
.Rprofile
中),但 key 是免费的:options(BingMapsKey="whateverBingGivesYouForYourKey")
关于r - 确定两个邮政编码之间的距离(替代 mapdist),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17361909/