lonlat2bbox: Bounding box from lon and lat values

View source: R/lonlat2bbox.R

lonlat2bboxR Documentation

Bounding box from lon and lat values

Description

Bounding box from lon and lat values

Usage

lonlat2bbox(lon, lat, width = NULL, dist = NULL, units = "kilometers",
  method = "sp_rgeos", ...)

Arguments

lon

(numeric) longitude

lat

(numeric) latitude

width

(numeric) width, passed on to [rgeos::gBuffer()], see it's docs for more info. units are metric, so 10 is 10 m, 1000 is 1000 m, etc.

dist

(numeric) distance. passed on to [lawn::lawn_buffer()]

units

(character) units. passed on to [lawn::lawn_buffer()]. Default: kilometers

method

(character) which method to use, either combination of sp and rgeos ("sp_rgeos") or lawn

...

additional parameters passed on to [rgeos::gBuffer()]

Value

bounding box numeric values in the order '[minX, minY, maxX, maxY]'

Examples

# 10m
lonlat2bbox(lon=-120, lat=45, width=10)
# 100m
lonlat2bbox(-120, 45, 100)
# 1000m, or 1 km
lonlat2bbox(-120, 45, 1000)
# 10 km
lonlat2bbox(-120, 45, 10^4)

ropensci/bbox documentation built on May 15, 2022, 9:06 a.m.