Determining the distance between two ZIP codes (alternatives to mapdist)

前端 未结 3 1509
遥遥无期
遥遥无期 2020-12-08 05:59

I want to calculate the distance between approx. 100,000 different ZIP codes. I know about the mapdist function in the ggmap package

相关标签:
3条回答
  • 2020-12-08 06:17

    If you start a new R session and run library(ggmap) in the new session, you can make another 2500 queries.

    Function distQueryCheck() shows how many queries are remaining.

    0 讨论(0)
  • 2020-12-08 06:25

    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" )
    

    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")
    
    0 讨论(0)
  • 2020-12-08 06:30

    This might be trivial, but one completely free option is to use Census ZCTA geography data to get co-ordinates for each zip code, and then calculate Haversine distances (or some similar distance metric) between coordinates.

    0 讨论(0)
提交回复
热议问题