Skip to contents

Wraps tidygeocoder::geo and tidygeocoder::geocode to convert a character string or a data frame with an address column.

Usage

address_to_sf(
  x,
  address = "address",
  coords = c("lon", "lat"),
  remove_coords = FALSE,
  crs = NULL,
  ...
)

Arguments

x

Data frame with an address column. Multiple address columns are not currently supported.

address

Address column name, Default: 'address'

coords

Coordinate columns for input dataframe or output sf object (if geometry is 'centroid' or 'point') Default: c("lon", "lat").

remove_coords

For df_to_sf, if TRUE, remove the coordinate columns after converting a data frame to simple feature object; defaults to FALSE.

crs

Cordinate reference system to return, Default: 4326 for sf_to_df and NULL for df_to_sf

...

Additional parameters passed to tidygeocoder::geo or tidygeocoder::geocode

Value

A sf object with POINT geometry for all geocoded addresses with valid coordinates.

See also