location_getSingleAddress_Photon: Get address data from the Photon API to OpenStreetMap

Description Usage Arguments Value References Examples

View source: R/location_getSingleAddress_Photon.R

Description

The Photon API is used get address data associated with the longitude and latitude. The following list of data is returned:

The function makes an effort to convert both state and country Name into Code with codes defaulting to NA. Both Name and Code are returned so that improvements can be made in the conversion algorithm.

Usage

1
2
3
4
5
6
location_getSingleAddress_Photon(
  longitude = NULL,
  latitude = NULL,
  baseUrl = "https://photon.komoot.io/reverse",
  verbose = TRUE
)

Arguments

longitude

Single longitude in decimal degrees E.

latitude

Single latitude in decimal degrees N.

baseUrl

Base URL for data queries.

verbose

Logical controlling the generation of progress messages.

Value

List of address components.

References

https://photon.komoot.io

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(MazamaLocationUtils)

# Fail gracefully if any resources are not available
try({

  # Set up standard directories and spatial data
  spatialDataDir <- tempdir() # typically "~/Data/Spatial"
  mazama_initialize(spatialDataDir)

  # Wenatchee
  lon <- -120.325278
  lat <- 47.423333

  addressList <- location_getSingleAddress_Photon(lon, lat)
  str(addressList)
  
}, silent = FALSE)

MazamaLocationUtils documentation built on Nov. 16, 2021, 9:15 a.m.