geoCode: Geocoding

geocodeR Documentation

Geocoding

Description

A wrapper around the tidygeocoding and Wikipedia services. Users can request a data.frame (default), vector (xy = TRUE), point (pt = TRUE), and/or a bounding box (bbox = TRUE) representation of a place/location (geo) or event. One or more can be given at a time.

If a single entitiy is requested, 'geocode' will provide a data.frame of lat/lon values and, if requested, a point object and the derived bounding box of the geo/event.

If multiple entities are requested, the returned objects will be a data.frame with columns for input name-lat-lon; if requested, a POINT object will be returned. Here, the bbox argument will return the minimum bounding box of all place names.

Usage

geocode(
  geo = NULL,
  event = NULL,
  pt = FALSE,
  bbox = FALSE,
  all = FALSE,
  xy = FALSE,
  method = default_method,
  crs = default_crs
)

Arguments

geo

character. Place name(s)

event

character. a term to search for on Wikipedia

pt

logical. If TRUE point geometry is created.

bbox

logical. If TRUE bounding box geometry is created

all

logical. If TRUE the point, bbox and xy representations are returned as a list

xy

logical. If TRUE a named xy numeric vector is created

method

the geocoding service to be used. See ?tidygeocoder::geocode

crs

desired CRS. Defaults to AOI::default_crs

Value

a data.frame, sf object, or vector

See Also

Other geocode: geocode_rev(), geocode_wiki()

Examples

## Not run: 
## geocode a single locations
geocode("UCSB")

## geocode a single location and return a POINT object
geocode("UCSB", pt = TRUE)

## geocode a single location and derived bbox of location
geocode(location = "UCSB", bbox = TRUE)

## geocode multiple locations
geocode(c("UCSB", "Goleta", "Santa Barbara"))

## geocode multiple points and generate a minimum bounding box of all locations and spatial points
geocode(c("UCSB", "Goleta", "Santa Barbara"), bbox = T, pt = T)

## End(Not run)

mikejohnson51/AOI documentation built on Nov. 22, 2023, 6:05 p.m.