geocode_address: Geocode an address

Description Usage Arguments Value Examples

View source: R/geocode_address.R

Description

Geocode an address using the Bing geocoding API, to get a cleaned address, municipality, postal code, latitude, and longitude. This function adds an additional 0.25 seconds at the end of the call to comply with the Bing API license, which only allows 5 calls per second.

Usage

1
2
3
4
5
6
geocode_address(
  address,
  base = "http://dev.virtualearth.net/REST/v1/Locations/CA/",
  token = Sys.getenv("BING_TOKEN"),
  quiet = FALSE
)

Arguments

address

Address to geocode

base

Base URL of Bing Geocoder: http://dev.virtualearth.net/REST/v1/Locations/CA/

token

BING Geocoder token, defaults to BING_TOKEN environment variable.

quiet

Whether to silence message that address is being geocoded, with its status - defaults to FALSE (display the message). Useful if geocoding many addresses at once.

Value

A tibble containing status code, address, municipality, postal code, method used, method confidence, latitude, and longitude.

Examples

1
2
3
4
5
6
geocode_address("235 Bloor St E Toronto ON")

geocode_address("25 Grandstand Toronto ON")

# Ranges of addresses are geocoded to the first address:
geocode_address("1187-1189  QUEEN ST E Toronto ON")

purposeanalytics/lemur documentation built on Dec. 22, 2021, 10:52 a.m.