25

I am currently working on a large population-based database where it is required that I compute the distance between two addresses for each individual. My first train of thought was to obtain the latitude and longitude representing each address and then compute the distance. I used Google API's to obtain the latitude and longitude for these addresses via various packages in R (e.g. dismo). However Google has a restriction of 2500 requests in a 24hr period. I have about 300,000 addresses and by running 2,500/day, I will not be able to meet the deadline.

Would anyone have suggestions regarding other API's I could use to obtain the latitude and longitude using R?

Thank you.

user1106711
  • 355
  • 1
  • 4
  • 8

3 Answers3

15

I would recommend that you try the RDSTK package which interfaces with the Data Science Toolkit. It is available on github.

EDIT. To compute the Road Distance, I would recommend the Mapquest Directions API, which appears to have no preset limits as per this link. Let me know how it goes.

Ramnath
  • 54,439
  • 16
  • 125
  • 152
  • +1. Thank you @Ramnath. This website is immensely helpful. I will try this out. – user1106711 Jan 30 '12 at 20:15
  • Would you have suggestions for computing the 'road' distance between two addresses as Google does? – user1106711 Jan 30 '12 at 20:52
  • Thank you. I guess I will need to learn how to use javascript from within R to call this function. – user1106711 Jan 30 '12 at 22:08
  • 1
    you may not need to use javascript. if you look at the code, i think you can construct the URL using the coordinates, and use a package like `RCurl` to send a `GET/POST` request to fetch the desired data. – Ramnath Jan 31 '12 at 03:25
5

What you are doing is called "geocoding". Knowing that will greatly improve your ability to search for more info :) You may have already known that since you tagged the question properly, but I wanted to make sure.

Here's a really good previous Stack Overflow question, albeit not R specific.

Community
  • 1
  • 1
JD Long
  • 59,675
  • 58
  • 202
  • 294
  • Thank you @JD Long. I do realize that the specific term is geocoding, hence the tag attached to my question. The link you sent does have a lot of resources. I will check them out for any R specific solutions. – user1106711 Jan 30 '12 at 20:16
2

More options:

Besides, the gdistance package is useful for distance calculations on geographical grids.

Oscar Perpiñán
  • 4,491
  • 17
  • 28