arc_geo: Geocoding using the ArcGIS REST API

View source: R/arc_geo.R

arc_geoR 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 components), use arc_geo_multi().

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

Single-line address text (e.g. "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. Each query has a hard API limit of 50 results.

full_results

Logical; if TRUE return all available API fields via ⁠outFields=*⁠. Default is FALSE.

return_addresses

Logical; if TRUE keep input query in output.

verbose

Logical; if TRUE output process messages to console.

progressbar

Logical; if TRUE shows a progress bar for multiple points.

outsr

The spatial reference of the ⁠x,y⁠ coordinates returned by a geocode request. By default is NULL (i.e. the argument 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

Country filter using ISO codes (e.g. "USA"). Multiple values can be specified (comma-separated).

category

Place or address type used as a filter. Multiple values are accepted (e.g. c("Cinema", "Museum")). See arc_categories.

custom_query

Additional API parameters as named list values.

Details

See the ArcGIS REST docs for more info and valid values.

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)



arcgeocoder documentation built on March 20, 2026, 5:10 p.m.