geocode_osm {SUNGEO}R Documentation

Geocode addresses with OpenStreetMap

Description

Function to find geographic coordinates of addresses and place names, using OpenStreetMap's Nominatum API.

Usage

geocode_osm(
  query,
  match_num = 1,
  return_all = FALSE,
  details = FALSE,
  user_agent = NULL
)

Arguments

query

Address or place name to be geocoded. Character string.

match_num

If query matches multiple locations, which match to return? Default is 1 (highest-ranking match, by relevance). Numeric.

return_all

Should all matches be returned? Overrides match_num if TRUE. Default is FALSE. Logical.

details

Should detailed results be returned? Default is FALSE. Logical.

user_agent

Valid User-Agent identifying the application for OSM-Nominatum. If none supplied, function will attempt to auto-detect. Character string.

Details

Note that Nominatim Usage Policy stipulates an absolute maximum of 1 request per second (https://operations.osmfoundation.org/policies/nominatim/). For batch geocoding of multiple addresses, please use geocode_osm_batch.

Value

A data.frame object. If details=FALSE, contains fields

If details=TRUE, contains additional fields

Examples

# Geocode an address (top match only)
## Not run: 
geocode_osm("Michigan Stadium")

## End(Not run)
# Return detailed results for top match
## Not run: 
geocode_osm("Michigan Stadium", details=TRUE)

## End(Not run)
# Return detailed results for all matches
## Not run: 
geocode_osm("Michigan Stadium", details=TRUE, return_all = TRUE)

## End(Not run)

[Package SUNGEO version 1.3.0 Index]