geocode: Geocode using the Google Maps

Description Usage Arguments Details Source Examples

View source: R/google.R

Description

Interrogate the Google Maps API to geocode a specified location. Geocoding provides longitude, latitude and some additional data. including full address where available.

Usage

1
2
geocode(location, output = c("summary", "longlat", "detail", "json", "list",
  "matches", "url"), item, region = "AU", ...)

Arguments

location

vector of location strings.

output

string specifying desired output.

region

two letter country code to determine search bias.

item

numeric value specifying which result to return if there are multiple matches.

...

additional parameters passed to the Google API.

Details

The Google API attempts a fuzzy match of the specified location(s). Where the location is ambiguous, a single result will be returned and the specified search bias region will used to assist in making a selection.

Notice there is a limit of 2,500 calls per day. Currently, the function does not enforce this limit, so exercise caution!

Location type, for more info check here: https://developers.google.com/maps/documentation/directions/ "ROOFTOP" indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision. "RANGE_INTERPOLATED" indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address. "GEOMETRIC_CENTER" indicates that the returned result is the geometric center of a result such as a polyline (for example, a street) or polygon (region). "APPROXIMATE" indicates that the returned result is approximate.

Source

The code is adapted from Jose Gonzales. This function is very similar to the geocode function in the ggmap package.

Examples

1
2
3
4
5
6
7
8
## Not run: 
geocode("64 Reservoir St Surry Hills")
geocode("64 Reservoir St Surry Hills", output="longlat")
geocode("64 Reservoir St", output="matches")
geocode("64 Reservoir St", output="list")
geocode("64 Reservoir St", output="list", country="AU")

## End(Not run)

seancarmody/rmapaus documentation built on May 29, 2019, 4:26 p.m.