Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getGeoCode

geocoding utility


Description

Geocode your data using, R, JSON and OSM or Google Maps' Geocoding APIs

Usage

getGeoCode(gcStr, API = c("osm", "google")[1], JSON = FALSE, 


    verbose = 0)

Arguments

gcStr

adddress to geocode

API

which API to use. see https://nominatim.org/release-docs/develop/api/Search/ and http://allthingsr.blogspot.de/2012/01/geocode-your-data-using-r-json-and.html

JSON

use the JSON protocol. If FALSE, we do not have to load additional libraries

verbose

level of verbosity

Value

returns lat/lon for address

Author(s)

Markus Loecher

Examples

if (0){


  getGeoCode("1600 Amphitheatre Parkway, Mountain View, CA")


  getGeoCode("Brooklyn")


  #You can run this on the entire column of a data frame or a data table:


  DF = cbind.data.frame(address=c("Berlin,Germany", "Princeton,NJ", 


            "cadillac+mountain+acadia+national+park"), lat = NA, lon = NA)


  DF <- with(DF, data.frame(address, t(sapply(DF$address, getGeoCode))))


}

RgoogleMaps

Overlays on Static Maps

v1.4.5.3
GPL
Authors
Markus Loecher
Initial release
2020-02-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.