geocodePlace: Get the coordinates of an place/establishment

Description Usage Arguments Details Value Examples

View source: R/geocodePlace.R

Description

Get the coordinates of an address using the Google Places API. Note: An API key must first be obtained from Google.

Usage

1
geocodePlace(name, rough.crd, radius = 50000, key, result = 1, pause.time = 0.02)

Arguments

name

The name of the place/establishment to search for.

rough.crd

The rough coordinates of the location, e.g. the neighborhood or city in which the place/establishment is located. For example: c(-74.00, 40.71)

radius

The radius in meters from the rough coordinates to search within. Default is 50,000.

key

API key from the Google Places API.

result

Which search result to use. The default is the first result.

pause.time

Amount of time in seconds to wait after a request (if performing multiple requests in a loop).

Details

An API key must first be obtained to use the Google Places API. By default the function returns the first result from the search. This can be checked for accuracy by looking at the other components in the result. If this is incorrect, the second result can be tried using result = 2.

Value

crd

A vector of the longitude and latitude of the place/establishment.

name

The name of the place/establishment returned by Google.

types

The types of the place/establishment

vicinity

The address of the place/establishment.

Examples

1
2
3
4
5
6
  ## Not run: 
  geocodePlace("Madison Square Garden",
               rough.crd = geocodeAddress("New York City")$crd,
               key = YOUR.API.KEY)
  
## End(Not run)

walshc/GoogleMapsAPI documentation built on May 3, 2019, 11:50 p.m.