Skip to contents

Converts any point, line, or polygon sf layer to WGS84 and returns a named latitude/longitude bounding box suitable for geocode_records(), geocode_arcgis(), geocode_by_name(), and validate_geocodes(). This is the safest way to keep multi-state geocoding and local geography joins aligned: build or load the geography layer first, then derive the bbox from it.

Usage

bbox_from_sf(geography_shapes, buffer = 0.05)

Arguments

geography_shapes

An sf object.

buffer

Numeric buffer in decimal degrees added to each side of the bounding box. Defaults to 0.05 to avoid rejecting edge locations.

Value

A named numeric vector with lat_min, lat_max, lon_min, and lon_max.

Examples

if (interactive()) {
areas <- build_local_geography("PA")
bbox <- bbox_from_sf(areas)
}