Skip to contents

Location can be:

Usage

location_filter(
  data,
  location = NULL,
  dist = NULL,
  diag_ratio = NULL,
  asp = NULL,
  unit = "meter",
  crs = NULL,
  trim = FALSE,
  crop = TRUE,
  ...
)

Arguments

data

Data to filter by location.

location

A sf, sfc, or bbox object or a character string that is an address, county GeoID, state name, abbreviation, or GeoID (dist parameters are ignored if location is a character string).

dist

buffer distance in units. Optional.

diag_ratio

ratio of diagonal distance of area's bounding box used as buffer distance. e.g. if the diagonal distance is 3000 meters and the "diag_ratio = 0.1" a 300 meter will be used. Ignored when dist is provided.

asp

Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). If numeric, get_asp() returns the same value without modification.

unit

Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter"

crs

Coordinate reference system of bounding box to return

trim

If TRUE, data is trimmed to area with sf::st_intersection. This option ignores any dist, diag_ratio, or asp parameters. Default FALSE.

crop

If TRUE, data is cropped to location or bounding box sf::st_crop adjusted by the dist, diag_ratio, and asp parameters provided. Default TRUE.

...

Additional parameters; bbox (used instead of location or adjusted location), county and state (used with get_counties or get_states), join (passed to sf::st_filter)

Details

  • A sf, bbox, or sfc object

  • A U.S. state (name, abbreviation, or GeoID) or county (GeoID)

  • An address