-4

Please. I need an function in r to get latitude and longitude from an specific address.

My addresses are peruavian. For example:

  1. Jirón Cuzco 423, Magdalena del Mar
  2. Av Nicolás Arriola 500, La Victoria

Thanks!!

user3605895
  • 31
  • 2
  • 7
  • 1
    hope this link help https://stackoverflow.com/questions/9068941/obtain-latitude-and-longitude-from-address-without-the-use-of-google-api – BENY Jun 13 '17 at 17:27

1 Answers1

7

geocode from the ggmap package will do the trick:

library(ggmap)
locs <- c('Jiron Cuzco 423, Magdalena del Mar', 'Av Nicolas Arriola 500, La Victoria')
geocode(locs)

Output:

        lon      lat
1 -77.07008 -12.0894
2 -77.01523 -12.0856
Val
  • 6,585
  • 5
  • 22
  • 52