reverse_geo_lite_sf: Get spatial objects through reverse geocoding

Description Usage Arguments Details Value See Also Examples

View source: R/reverse_geo_lite_sf.R

Description

This function allows you extract the spatial object located on a known pair of coordinates (lat, long). Latitudes must be between -90 and 90 and longitudes must be between -180 and 180.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
reverse_geo_lite_sf(
  lat,
  long,
  address = "address",
  full_results = FALSE,
  return_coords = TRUE,
  verbose = FALSE,
  custom_query = list(),
  points_only = TRUE
)

Arguments

lat

latitude values (input data)

long

longitude values (input data)

address

name of the address column (in the output data)

full_results

returns all available data from the geocoding service if TRUE. If FALSE (default) then only a single address column is returned from the geocoding service.

return_coords

return input coordinates with results if TRUE. Note that most services return the input coordinates with full_results = TRUE and setting return_coords 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 (ie. list(zoom = 3)). 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).

Details

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

Use the option custom_query = list(zoom = 3) to adjust the output. Some equivalences on terms of zoom:

zoom address_detail
3 country
5 state
8 county
10 city
14 suburb
16 major streets
17 major and minor streets
18 building

Value

A sf object with the results.

See Also

reverse_geo_lite()

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
library(ggplot2)


Coliseum <- geo_lite("Coliseo, Rome, Italy")

# Coliseum
Col_sf <- reverse_geo_lite_sf(
  lat = Coliseum$lat,
  lon = Coliseum$lon,
  points_only = FALSE
)

ggplot(Col_sf) +
  geom_sf()

# City of Rome - Zoom 10

Rome_sf <- reverse_geo_lite_sf(
  lat = Coliseum$lat,
  lon = Coliseum$lon,
  custom_query = list(zoom = 10),
  points_only = FALSE
)

ggplot(Rome_sf) +
  geom_sf()

# County - Zoom 8

County_sf <- reverse_geo_lite_sf(
  lat = Coliseum$lat,
  lon = Coliseum$lon,
  custom_query = list(zoom = 8),
  points_only = FALSE
)

ggplot(County_sf) +
  geom_sf()

nominatimlite documentation built on Nov. 27, 2021, 1:07 a.m.