bboxToVector: Convert and validate bbox objects or strings into standard...

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Accepts a variety of bbox formats, validates that they are numerically sane and returns a vector of floats in c(lonLo, lonLo, latLo, latHi) order. Input can be a vector of floats in c(lonLo, lonHi, latLo, latHi) order or the return value from sp::bbox() or raster::extent().

Usage

1

Arguments

bbox

Bounding box for the region of interest.

Value

a vector of floats in c(lonLo, lonHi, latLo, latHi) order.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
library(MazamaSpatialUtils)
library(MazamaSatelliteUtils)

setSpatialDataDir("~/Data/Spatial")
setSatelliteDataDir("~/Data/Satellite")

loadSpatialData("USCensusStates")

oregon <- subset(USCensusStates, stateCode == "OR")
bbox <- sp::bbox(oregon)

scanFile <- goesaodc_downloadScanFiles(
  satID = "G16", 
  datetime = "2019-09-06 18:00", 
  timezone = "UTC"
)

scanRaster <- goesaodc_createScanRaster(
  filename = scanFile,
  cellSize = 0.1,
  dqfLevel = 2
)

extent <- raster::extent(scanRaster)

# Convert bbox
bbox
bboxToVector(bbox)

# Convert extent
extent
bboxToVector(extent)

# Convert low/hi mixup
bboxToVector(c(-116, -124, 42, 46))

MazamaScience/MazamaSatelliteUtils documentation built on Dec. 17, 2021, 3:20 a.m.