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
( |
lat |
latitude column name in the output data (default |
long |
longitude column name in the output data (default |
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 |
return_addresses |
return input addresses with results if |
verbose |
if |
progressbar |
Logical. If |
outsr |
The spatial reference of the |
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.
|
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
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)