且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-01 22:55:15

taRifx.geo::georoute(仅可用 这里 直到我推出另一个更新,此时它将通过 install.packages 可用)可以使用 Bing 地图(我相信每天支持 25k)并且可以返回一个距离.

taRifx.geo::georoute (only available here until I push out another update, at which point it will be available via install.packages) can use Bing Maps (which supports I believe 25k per day) and can return a distance.

georoute( c("3817 Spruce St, Philadelphia, PA 19104", 
            "9000 Rockville Pike, Bethesda, Maryland 20892"), 
             verbose=TRUE, returntype="time", 
             service="bing" )

您必须获得一个 Bing Maps API 密钥并将其设置在您的 R 全局选项中(理想的位置是在 .Rprofile 中),但该密钥是免费的:

You'll have to get a Bing Maps API key and set it in your R global options (ideal placement is in .Rprofile), but the key is free:

options(BingMapsKey="whateverBingGivesYouForYourKey")