geocode_osm_batch {SUNGEO}R Documentation

Batch geocode addresses with OpenStreetMap

Description

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

Usage

geocode_osm_batch(
  query,
  delay = 1,
  return_all = FALSE,
  match_num = 1,
  details = FALSE,
  user_agent = NULL,
  verbose = FALSE
)

Arguments

query

Addresses or place names to be geocoded. Character string.

delay

Delay between requests. Default is 1 second. Numeric.

return_all

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

match_num

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

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.

verbose

Print status messages and progress? Default is FALSE. Logical.

Details

Wrapper function for geocode_osm. Because Nominatim Usage Policy stipulates an absolute maximum of 1 request per second, this function facilitates batch geocoding by adding a small delay between queries (https://operations.osmfoundation.org/policies/nominatim/).

Value

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

If details=TRUE, contains additional fields

Examples

# Geocode multiple addresses (top matches only)
## Not run: 
geocode_osm_batch(c("Ann Arbor","East Lansing","Columbus"))

## End(Not run)
# With progress reports
## Not run: 
geocode_osm_batch(c("Ann Arbor","East Lansing","Columbus"), verbose = TRUE)

## End(Not run)
# Return detailed results for all matches
## Not run: 
geocode_osm_batch(c("Ann Arbor","East Lansing","Columbus"),
                  details = TRUE, return_all = TRUE)

## End(Not run)

[Package SUNGEO version 1.3.0 Index]