reverse {photon} | R Documentation |
Reverse geocoding
Description
Reverse geocode a set of points to retrieve their corresponding place names. To geocode a place name or an address, see unstructured or structured geocoding.
Usage
reverse(
.data,
radius = NULL,
limit = 1,
lang = "en",
osm_tag = NULL,
layer = NULL,
locbias = NULL,
locbias_scale = NULL,
zoom = NULL,
distance_sort = TRUE,
progress = interactive()
)
Arguments
.data |
A dataframe or list with names |
radius |
Numeric specifying the range around the points in |
limit |
Number of results to return. A maximum of 50 results can be
returned for a single search term. Defaults to 1. When more than a single
text is provided but limit is greater than 1, the results can be uniquely
linked to the input texts using the |
lang |
Language of the results. If |
osm_tag |
Character string giving an OSM tag to filter the results by. See details. |
layer |
Character string giving a layer to filter the results by.
Can be one of |
locbias |
Numeric vector of length 2 or any object that can be coerced
to a length-2 numeric vector (e.g. a list or |
locbias_scale |
Numeric vector specifying the importance of prominence
in |
zoom |
Numeric specifying the radius for which the |
distance_sort |
If |
progress |
If |
Details
Filtering by OpenStreetMap tags follows a distinct syntax explained on https://github.com/komoot/photon. In particular:
Include places with tag:
key:value
Exclude places with tag:
!key:value
Include places with tag key:
key
Include places with tag value:
:value
Exclude places with tag key:
!key
Exclude places with tag value:
:!value
Value
An sf dataframe or tibble containing the following columns:
idx
: Internal ID specifying the index of thetexts
parameter.osm_type
: Type of OSM element, one of N (node), W (way), R (relation), or P (polygon).osm_id
: OpenStreetMap ID of the matched element.country
: Country of the matched place.city
: City of the matched place.osm_key
: OpenStreetMap key.countrycode
: ISO2 country code.housenumber
: House number, if applicable.postcode
: Post code, if applicable.locality
: Locality, if applicable.street
: Street, if applicable.district
: District name, if applicable.osm_value
: OpenStreetMap tag value.name
: Place name.type
: Layer type as described for thelayer
parameter.extent
: Boundary box of the match.
Examples
# an instance must be mounted first
photon <- new_photon()
# works with sf objects
sf_data <- sf::st_sfc(sf::st_point(c(8, 52)), sf::st_point(c(7, 52)))
reverse(sf_data)
# ... but also with simple dataframes
df_data <- data.frame(lon = c(8, 7), lat = c(52, 52))
reverse(df_data)
# limit search radius to 10m
reverse(df_data, radius = 10)