View source: R/geo_address_lookup_sf.R
| geo_address_lookup_sf | R Documentation |
The lookup API queries the address and other details of one or more
OSM objects, such as nodes, ways or relations, and returns the
sf object associated with the query using sf. See
geo_address_lookup() for retrieving the data in tibble
format.
geo_address_lookup_sf(
osm_ids,
type = c("N", "W", "R"),
full_results = FALSE,
return_addresses = TRUE,
verbose = FALSE,
nominatim_server = "https://nominatim.openstreetmap.org/",
custom_query = list(),
points_only = TRUE
)
osm_ids |
Vector of OSM identifiers as numeric values, for example
|
type |
Character vector of the OSM object type associated with each
|
full_results |
Return all available data from the Nominatim API.
If |
return_addresses |
Return input addresses with results if |
verbose |
If |
nominatim_server |
URL of the Nominatim server to use. Defaults to
|
custom_query |
Named list with API-specific parameters, for example
|
points_only |
Logical |
See https://nominatim.org/release-docs/latest/api/Lookup/ for additional
parameters to be passed to custom_query.
An sf object with the results that match the query.
The parameter points_only specifies whether the function results will be
points (all Nominatim results are guaranteed to have at least point
geometry) or other geometry types.
Note that when points_only = FALSE, the type of geometry returned depends
on the object being geocoded. Administrative areas, major buildings and the
like will be returned as polygons, rivers, roads and similar features will
be returned as lines, and amenities may still be returned as points.
This function is vectorized, allowing multiple addresses to be geocoded.
With points_only = FALSE, multiple geometry types may be returned.
Address lookup:
geo_address_lookup()
Geocoding:
geo_address_lookup(),
geo_amenity(),
geo_amenity_sf(),
geo_lite(),
geo_lite_sf(),
geo_lite_struct(),
geo_lite_struct_sf()
sf outputs:
bbox_to_poly(),
geo_amenity_sf(),
geo_lite_sf(),
geo_lite_struct_sf(),
reverse_geo_lite_sf()
# Notre Dame Cathedral, Paris
NotreDame <- geo_address_lookup_sf(osm_ids = 201611261, type = "W")
# Require at least one non-empty object
if (!all(sf::st_is_empty(NotreDame))) {
library(ggplot2)
ggplot(NotreDame) +
geom_sf()
}
NotreDame_poly <- geo_address_lookup_sf(201611261,
type = "W",
points_only = FALSE
)
if (!all(sf::st_is_empty(NotreDame_poly))) {
ggplot(NotreDame_poly) +
geom_sf()
}
# Vectorized input
several <- geo_address_lookup_sf(c(146656, 240109189), type = c("R", "N"))
several
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.