r - 确定两个邮政编码之间的距离(替代 mapdist)

标签 r google-maps-api-3 geospatial spatial ggmap

我想计算大约之间的距离。 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/

相关文章:

替换环境中所有数据框中的字符

r - 结合地理数据中的县

mysql - ST_Distance_Spheroid 不存在

sql - 在oracle上创建空间索引

google-maps - 如何使用Flutter获取真实的方向指示? (绘制真实路线)

javascript - 谷歌地图 infowindow 错误 f = undefined infowindow.js

r - 在 R 中有效地创建向量的困惑

r - 在 R 中拆分数据框时删除列

r - 如何使用 R 中的 rms 包进行负二项式回归?

java - 为Google map 创建插件