geo_search: Retrieve Geoclient Response for Any Location Type as a...

Description Usage Arguments Details Examples

View source: R/geo_search.R

Description

This function takes any of the 6 location types as a single input and returns the Geoclient response as a tibble. The locations are provided either in a single vector as a named argument or with a dataframe and column name of the location field. This function is helpful when your address data is not separated into components. The Geoclient API key can either be provided directly as an argument, or you can first use geoclient_api_key() to add it to your .Renviron file so it can be called securely without being stored in your code.

Usage

1
2
3
geo_search_data(.data, location, key = NULL, rate_limit = TRUE)

geo_search(location, key = NULL, rate_limit = TRUE)

Arguments

.data

Dataframe containing columns to be used for other arguments.

location

Any of the 6 locations types from other functions: Address, BBL, BIN, Blockface, Intersection, or Place. The argument can be either a single vector of locations, or a bare column name of the location field if a dataframe is provided.

key

The API key provided to you from the NYC Developer Portal formated in quotes. Defaults to NULL and your key is accessed from your .Renviron.

rate_limit

Whether you would like to limit the rate of API requests in adherence to Geoclient's Service Usage Guidelines. See ?geoclient for more information.

Details

Geoclient is quite flexible with the format of the address when provided as a single input for this function, however the results may be slower than the more restrictive geo_address() because Geoclient may have to make multiple requests to narrow in on the correct location.

For more details see the Geoclient Documentation's guide to single-input requests, interpreting the Geosupport return codes, and a complete data dictionary for all possible data elements returned by any geoclient function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 

geoclient_api_key("9d8f7b6wh4jfgud67s89jfyw68vj38fh")

geo_search(1005430053) # BBL
geo_search("139 macdougal st mn") # Address
geo_search(c("1008760", "1007941")) # BIN

library(dplyr)

df <- tibble(
  location = c(
    "1005430053",
    "139 MacDougal Street, New York, 10012",
    "1008760"
   )
 )

geo_search_data(df, location)

bind_cols(df, geo_search_data(df, location))


## End(Not run)

austensen/geoclient documentation built on Nov. 20, 2021, 11:12 p.m.