bbox_from_points: Create an sf bounding box from a list of longitude and...

View source: R/bboxPolygon.R

bbox_from_pointsR Documentation

Create an sf bounding box from a list of longitude and latitudes

Description

Can work with up to 2 points

Usage

bbox_from_points(list_lng, list_lat, crs = 4326)

Arguments

crs

Examples

## Not run: 
library(sf)
library(ggplot2)
lats <- c(45.6,44.2)
lngs <- c(-71.1,-73.1)
shp_bbox <- bbox_from_points(lats, lngs)
shp_points <- st_as_sf( data.frame(lat=lats, lng=lngs), coords=c('lat', 'lng'), crs=4326)
ggplot() + geom_sf(data=shp_points) + geom_sf(data=shp_bbox)

## End(Not run)

cgauvi/sfSpHelpers documentation built on June 30, 2023, 10:48 p.m.