Generates an address from a latitude and longitude. Latitudes must be in the range \(\left[-90, 90 \right]\) and longitudes in the range \(\left[-180, 180 \right]\). This function returns the tibble associated with each query.
Usage
arc_reverse_geo(
x,
y,
address = "address",
full_results = FALSE,
return_coords = TRUE,
verbose = FALSE,
progressbar = TRUE,
outsr = NULL,
langcode = NULL,
featuretypes = NULL,
locationtype = NULL,
custom_query = list()
)Arguments
- x
Longitude values in numeric format. Must be in the range \(\left[-180, 180 \right]\).
- y
Latitude values in numeric format. Must be in the range \(\left[-90, 90 \right]\).
- address
Output address column name (default
"address").- full_results
Logical. If
TRUE, return all available API fields.FALSE(default) returns latitude, longitude and address only.- return_coords
Logical. If
TRUE, return input coordinates with the results.- verbose
Logical. If
TRUE, output process messages to the console.- progressbar
Logical. If
TRUE, show a progress bar for multiple points.- outsr
The spatial reference of the
xandycoordinates returned by a geocode request. By default, it isNULL(i.e. the argument will not be used in the query). See Details and arc_spatial_references.- langcode
Sets the language in which reverse-geocoded addresses are returned.
- featuretypes
This argument limits the possible match types returned. By default, it is
NULL(i.e. the argument will not be used in the query). See Details.- locationtype
Specifies whether the output geometry of
featuretypes = "PointAddress"orfeaturetypes = "Subaddress"matches should be the rooftop point or street entrance location. Valid values areNULL(i.e. not using the argument in the query),"rooftop"and"street".- custom_query
API-specific arguments to be used, passed as a named list.
Value
A tibble with the corresponding results. The x and y
values returned by the API are named lon and lat. Note that these
coordinates correspond to the geocoded feature and may differ from the x
and y values provided as inputs.
See the details of the output in ArcGIS REST API service output.
Details
See the ArcGIS REST docs for more information and valid values.
outsr
The spatial reference can be specified as 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.
featuretypes
See vignette("featuretypes", package = "arcgeocoder") for a detailed
explanation of this argument.
This argument may be used to filter the type of feature returned when
geocoding. Possible values are "StreetInt", "DistanceMarker",
"StreetAddress", "StreetName", "POI", "Subaddress",
"PointAddress", "Postal" and "Locality".
It is also possible to use several values as a vector
(featuretypes = c("PointAddress", "StreetAddress")).
See also
Other functions for geocoding:
arc_geo(),
arc_geo_categories(),
arc_geo_multi()
Examples
# \donttest{
arc_reverse_geo(x = -73.98586, y = 40.75728)
#> # A tibble: 1 × 3
#> x y address
#> <dbl> <dbl> <chr>
#> 1 -74.0 40.8 178-198 W 44th St, New York, NY, 10036, USA
# Several coordinates.
arc_reverse_geo(x = c(-73.98586, -3.188375), y = c(40.75728, 55.95335))
#>
|
| | 0%
|
|========================= | 50%
|
|==================================================| 100%
#> # A tibble: 2 × 3
#> x y address
#> <dbl> <dbl> <chr>
#> 1 -74.0 40.8 178-198 W 44th St, New York, NY, 10036, USA
#> 2 -3.19 56.0 Thistle & Churn Ice Cream, 1 Waterloo Place, Canongate, Edinburg…
# With options: use additional arguments.
sev <- arc_reverse_geo(
x = c(-73.98586, -3.188375),
y = c(40.75728, 55.95335),
# Restrict to these features.
featuretypes = "POI,StreetInt",
# Return results in this WKID.
outsr = 102100,
verbose = TRUE, full_results = TRUE
)
#>
|
| | 0%
|
|========================= | 50%
#>
#> Entry point: https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?
#> Parameters:
#> - location=-73.98586,40.75728
#> - f=json
#> - outSR=102100
#> - featureTypes=POI,StreetInt
#> URL: https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=-73.98586,40.75728&f=json&outSR=102100&featureTypes=POI,StreetInt
#>
|
|==================================================| 100%
#>
#> Entry point: https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?
#> Parameters:
#> - location=-3.188375,55.95335
#> - f=json
#> - outSR=102100
#> - featureTypes=POI,StreetInt
#> URL: https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=-3.188375,55.95335&f=json&outSR=102100&featureTypes=POI,StreetInt
#>
dplyr::glimpse(sev)
#> Rows: 2
#> Columns: 39
#> $ x <dbl> -73.985860, -3.188375
#> $ y <dbl> 40.75728, 55.95335
#> $ address <chr> "W 44th St & Broadway, New York, NY, 10036, USA", "Thistl…
#> $ lat <dbl> 4976603, 7549116
#> $ lon <dbl> -8236060.8, -354916.9
#> $ Match_addr <chr> "W 44th St & Broadway, New York, New York, 10036", "Thist…
#> $ LongLabel <chr> "W 44th St & Broadway, New York, NY, 10036, USA", "Thistl…
#> $ ShortLabel <chr> "W 44th St & Broadway", "Thistle & Churn Ice Cream"
#> $ Addr_type <chr> "StreetInt", "POI"
#> $ Type <chr> NA, "Restaurant"
#> $ PlaceName <chr> NA, "Thistle & Churn Ice Cream"
#> $ AddNum <chr> NA, "1"
#> $ Address <chr> "W 44th St & Broadway", "1 Waterloo Place"
#> $ Block <chr> NA, NA
#> $ Sector <chr> NA, NA
#> $ Neighborhood <chr> "Times Square", "Canongate"
#> $ District <chr> "Manhattan", NA
#> $ City <chr> "New York", "Edinburgh"
#> $ MetroArea <chr> NA, "Edinburgh"
#> $ Subregion <chr> "New York County", "Midlothian"
#> $ Region <chr> "New York", "Scotland"
#> $ RegionAbbr <chr> "NY", "SCT"
#> $ Territory <chr> NA, NA
#> $ Postal <chr> "10036", "EH1 3EG"
#> $ PostalExt <chr> "4011", NA
#> $ CntryName <chr> "United States", "United Kingdom"
#> $ CountryCode <chr> "USA", "GBR"
#> $ X <dbl> -73.985793, -3.188273
#> $ Y <dbl> 40.75726, 55.95325
#> $ InputX <dbl> -73.985860, -3.188375
#> $ InputY <dbl> 40.75728, 55.95335
#> $ StrucType <chr> NA, NA
#> $ StrucDet <chr> NA, NA
#> $ StrucType1 <chr> NA, NA
#> $ StrucType2 <chr> NA, NA
#> $ StrucDet1 <chr> NA, NA
#> $ StrucDet2 <chr> NA, NA
#> $ wkid <int> 102100, 102100
#> $ latestWkid <int> 3857, 3857
# }
