View source: R/geo_lite_struct_sf.R
| geo_lite_struct_sf | R Documentation |
Geocodes addresses already split into components and returns the
corresponding sf object. The query output is returned as an
sf format. See geo_lite_struct() for retrieving the data in
tibble format.
Corresponds to the structured query search described in the
API endpoint. To
perform a free-form search, use geo_lite_sf().
geo_lite_struct_sf(
amenity = NULL,
street = NULL,
city = NULL,
county = NULL,
state = NULL,
country = NULL,
postalcode = NULL,
limit = 1,
full_results = FALSE,
return_addresses = TRUE,
verbose = FALSE,
nominatim_server = "https://nominatim.openstreetmap.org/",
custom_query = list(),
points_only = TRUE
)
amenity |
Name and/or type of POI. See also |
street |
House number and street name. |
city |
City. |
county |
County. |
state |
State. |
country |
Country. |
postalcode |
Postal code. |
limit |
Maximum number of results to return per input address. Note that each query returns a maximum of 50 results. |
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 |
The structured form of the search query allows you to look up an address that is already split into its components. Each parameter represents a field of the address. All parameters are optional. You should only use the ones that are relevant for the address you want to geocode.
See https://nominatim.org/release-docs/latest/api/Search/ 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.
Geocoding:
geo_address_lookup(),
geo_address_lookup_sf(),
geo_amenity(),
geo_amenity_sf(),
geo_lite(),
geo_lite_sf(),
geo_lite_struct()
sf outputs:
bbox_to_poly(),
geo_address_lookup_sf(),
geo_amenity_sf(),
geo_lite_sf(),
reverse_geo_lite_sf()
# Map
pl_mayor <- geo_lite_struct_sf(
street = "Plaza Mayor",
county = "Comunidad de Madrid",
country = "Spain", limit = 50,
full_results = TRUE, verbose = TRUE
)
# Outline
ccaa <- geo_lite_sf("Comunidad de Madrid, Spain", points_only = FALSE)
library(ggplot2)
if (any(!sf::st_is_empty(pl_mayor), !sf::st_is_empty(ccaa))) {
ggplot(ccaa) +
geom_sf() +
geom_sf(data = pl_mayor, aes(shape = addresstype, color = addresstype))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.