Learn R Programming

nominatimlite (version 0.1.6)

geo_address_lookup_sf: Get spatial objects from OSM ids

Description

This function allows you to extract the spatial objects for specific OSM objects.

Usage

geo_address_lookup_sf(
  osm_ids,
  type = c("N", "W", "R"),
  full_results = FALSE,
  return_addresses = TRUE,
  verbose = FALSE,
  custom_query = list(),
  points_only = TRUE
)

Arguments

osm_ids

vector of OSM identifiers (c(00000, 11111, 22222)).

type

vector of the type of the OSM type associated to each osm_ids. Possible values are node ("N"), way ("W") or relation ("R"). If a single value is provided it would be recycled.

full_results

returns all available data from the geocoding service if TRUE. If FALSE (default) then only latitude and longitude columns are returned from the geocoding service.

return_addresses

return input addresses with results if TRUE. Note that most services return the input addresses with full_results = TRUE and setting return_addresses to FALSE does not prevent this.

verbose

if TRUE then detailed logs are output to the console. FALSE is default. Can be set permanently with options(tidygeocoder.verbose = TRUE)

custom_query

API-specific parameters to be used, passed as a named list (i.e. list(countrycodes = "US")). See Details.

points_only

Logical TRUE/FALSE. Whether to return only spatial points (TRUE, which is the default) or potentially other shapes as provided by the Nominatim API (FALSE).

Value

A sf object with the results.

Details

See https://nominatim.org/release-docs/latest/api/Search/ for additional parameters to be passed to custom_query.

See Also

Other spatial: bbox_to_poly(), geo_amenity_sf(), geo_lite_sf(), reverse_geo_lite_sf()

Other lookup: geo_address_lookup()

Examples

Run this code
# NOT RUN {
# Notre Dame Cathedral, Paris

NotreDame <- geo_address_lookup_sf(
  osm_ids = c(201611261),
  type = c("W")
)

library(ggplot2)

ggplot(NotreDame) +
  geom_sf()

NotreDame_poly <- geo_address_lookup_sf(
  osm_ids = c(201611261),
  type = c("W"),
  points_only = FALSE
)

ggplot(NotreDame_poly) +
  geom_sf()
# }

Run the code above in your browser using DataLab