Geocodes addresses already split into components. This function returns the
tibble
associated with the query, see
geo_lite_struct_sf()
for retrieving the data as a spatial object
(sf
format).
This function correspond to the structured query search described in the
API endpoint. For
performing a free-form search use geo_lite()
.
Usage
geo_lite_struct(
amenity = NULL,
street = NULL,
city = NULL,
county = NULL,
state = NULL,
country = NULL,
postalcode = NULL,
lat = "lat",
long = "lon",
limit = 1,
full_results = FALSE,
return_addresses = TRUE,
verbose = FALSE,
nominatim_server = "https://nominatim.openstreetmap.org/",
custom_query = list()
)
Arguments
- amenity
Name and/or type of POI, see also geo_amenity.
- street
House number and street name.
- city
City.
- county
County.
- state
State.
- country
Country.
- postalcode
Postal Code.
- lat
Latitude column name in the output data (default
"lat"
).- long
Longitude column name in the output data (default
"long"
).- 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. If
FALSE
(default) only latitude, longitude and address columns are returned. See alsoreturn_addresses
.- return_addresses
Return input addresses with results if
TRUE
.- verbose
If
TRUE
then detailed logs are output to the console.- nominatim_server
The URL of the Nominatim server to use. Defaults to
"https://nominatim.openstreetmap.org/"
.- custom_query
A named list with API-specific parameters to be used (i.e.
list(countrycodes = "US")
). See Details.
Value
A tibble
with the results found by the query.
Details
The structured form of the search query allows to look up 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
.
See also
geo_lite_struct_sf()
, tidygeocoder::geo()
.
Geocoding:
geo_address_lookup()
,
geo_address_lookup_sf()
,
geo_amenity()
,
geo_amenity_sf()
,
geo_lite()
,
geo_lite_sf()
,
geo_lite_struct_sf()
Examples
# \donttest{
pl_mayor <- geo_lite_struct(
street = "Plaza Mayor", country = "Spain",
limit = 50, full_results = TRUE
)
dplyr::glimpse(pl_mayor)
#> Rows: 37
#> Columns: 44
#> $ q_amenity <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ q_street <chr> "Plaza Mayor", "Plaza Mayor", "Plaza Mayor", …
#> $ q_city <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ q_county <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ q_state <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ q_country <chr> "Spain", "Spain", "Spain", "Spain", "Spain", …
#> $ q_postalcode <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ lat <dbl> 40.41539, 40.96503, 41.65206, 40.02981, 41.50…
#> $ lon <dbl> -3.7069974, -5.6640558, -4.7285474, -6.090253…
#> $ address <chr> "Plaza Mayor, Calle de Toledo, Barrio de los …
#> $ place_id <int> 372872879, 284176853, 283717767, 284096857, 2…
#> $ licence <chr> "Data © OpenStreetMap contributors, ODbL 1.0.…
#> $ osm_type <chr> "relation", "way", "way", "way", "way", "way"…
#> $ osm_id <dbl> 16657232, 78180390, 24432960, 183289770, 4612…
#> $ category <chr> "tourism", "tourism", "tourism", "highway", "…
#> $ type <chr> "attraction", "attraction", "attraction", "pe…
#> $ place_rank <int> 30, 30, 30, 26, 26, 26, 26, 30, 26, 30, 30, 3…
#> $ importance <dbl> 0.4050655, 0.3429547, 0.3023239, 0.1846342, 0…
#> $ addresstype <chr> "tourism", "tourism", "tourism", "road", "roa…
#> $ name <chr> "Plaza Mayor", "Plaza Mayor", "Plaza Mayor", …
#> $ display_name <chr> "Plaza Mayor, Calle de Toledo, Barrio de los …
#> $ address.tourism <chr> "Plaza Mayor", "Plaza Mayor", "Plaza Mayor", …
#> $ address.road <chr> "Calle de Toledo", "Plaza Mayor", "Calle de S…
#> $ address.neighbourhood <chr> "Barrio de los Austrias", NA, NA, NA, "Los Al…
#> $ address.quarter <chr> "Sol", NA, NA, "El Berrocal", NA, NA, "San Pa…
#> $ address.city_district <chr> "Centro", "Centro", NA, NA, NA, NA, NA, NA, N…
#> $ address.city <chr> "Madrid", "Salamanca", "Valladolid", NA, "Zam…
#> $ address.state <chr> "Comunidad de Madrid", "Castilla y León", "Ca…
#> $ `address.ISO3166-2-lvl4` <chr> "ES-MD", "ES-CL", "ES-CL", "ES-EX", "ES-CL", …
#> $ address.postcode <chr> "28012", "37002", "47001", "10600", "49002", …
#> $ address.country <chr> "España", "España", "España", "España", "Espa…
#> $ address.country_code <chr> "es", "es", "es", "es", "es", "es", "es", "es…
#> $ address.province <chr> NA, "Salamanca", "Valladolid", "Cáceres", "Za…
#> $ `address.ISO3166-2-lvl6` <chr> NA, "ES-SA", "ES-VA", "ES-CC", "ES-ZA", "ES-A…
#> $ address.suburb <chr> NA, NA, "Plaza Mayor", NA, "Barrio La Lana", …
#> $ address.town <chr> NA, NA, NA, "Plasencia", NA, "Villena", NA, N…
#> $ address.region <chr> NA, NA, NA, NA, NA, "l'Alt Vinalopó / El Alto…
#> $ address.railway <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, "Plaza Ma…
#> $ address.retail <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, "Plaza Ma…
#> $ address.borough <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, "Churrian…
#> $ address.county <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, "Málaga-C…
#> $ address.village <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ address.hamlet <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ boundingbox <list> <40.414988, 40.415813, -3.708121, -3.706630>…
# }