arc_geo {arcgeocoder}R Documentation

Geocoding using the ArcGIS REST API

Description

Geocodes addresses given as character values. This function returns the tibble object associated with the query.

This function uses the SingleLine approach detailed in the ArcGIS REST docs. For multi-field queries (i.e. using specific address parameters) use arc_geo_multi() function.

Usage

arc_geo(
  address,
  lat = "lat",
  long = "lon",
  limit = 1,
  full_results = FALSE,
  return_addresses = TRUE,
  verbose = FALSE,
  progressbar = TRUE,
  outsr = NULL,
  langcode = NULL,
  sourcecountry = NULL,
  category = NULL,
  custom_query = list()
)

Arguments

address

character with single line address ("1600 Pennsylvania Ave NW, Washington") or a vector of addresses (c("Madrid", "Barcelona")).

lat

latitude column name in the output data (default "lat").

long

longitude column name in the output data (default "lon").

limit

maximum number of results to return per input address. Note that each query returns a maximum of 50 results.

full_results

returns all available data from the API service. This is a shorthand of ⁠outFields=*⁠. See References. If FALSE (default) only the default values of the API would be returned. See also return_addresses argument.

return_addresses

return input addresses with results if TRUE.

verbose

if TRUE then detailed logs are output to the console.

progressbar

Logical. If TRUE displays a progress bar to indicate the progress of the function.

outsr

The spatial reference of the ⁠x,y⁠ coordinates returned by a geocode request. By default is NULL (i.e. the parameter won't be used in the query). See Details and arc_spatial_references.

langcode

Sets the language in which reverse-geocoded addresses are returned.

sourcecountry

Limits the candidates returned to the specified country or countries. Acceptable values include the three-character country code. You can specify multiple country codes to limit results to more than one country.

category

A place or address type that can be used to filter results. Several values can be used as well as a vector (i.e. c("Cinema", "Museum")). See arc_categories for details.

custom_query

API-specific parameters to be used, passed as a named list.

Details

More info and valid values in the ArcGIS REST docs.

Value

A tibble object with the results. See the details of the output in ArcGIS REST API Service output.

outsr

The spatial reference can be specified as either a well-known ID (WKID). If not specified, the spatial reference of the output locations is the same as that of the service ( WGS84, i.e. WKID = 4326)).

See arc_spatial_references for values and examples.

References

ArcGIS REST findAddressCandidates.

See Also

tidygeocoder::geo()

Other functions for geocoding: arc_geo_categories(), arc_geo_multi(), arc_reverse_geo()

Examples



arc_geo("Madrid, Spain")

library(dplyr)

# Several addresses with additional output fields
with_params <- arc_geo(c("Madrid", "Barcelona"),
  custom_query = list(outFields = c("LongLabel", "CntryName"))
)

with_params %>%
  select(lat, lon, CntryName, LongLabel)

# With options: restrict search to USA
with_params_usa <- arc_geo(c("Madrid", "Barcelona"),
  sourcecountry = "USA",
  custom_query = list(outFields = c("LongLabel", "CntryName"))
)

with_params_usa %>%
  select(lat, lon, CntryName, LongLabel)



[Package arcgeocoder version 0.2.0 Index]