Skip to content

Commit

Permalink
mukey.wcs(): attempt alignment of WCS result with authoritative gri…
Browse files Browse the repository at this point in the history
…d topology for CONUS
  • Loading branch information
brownag committed Oct 27, 2023
1 parent eb7ad8d commit 551c717
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/mukey-WCS.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ mukey.wcs <- function(aoi, db = c('gNATSGO', 'gSSURGO', 'RSS', 'STATSGO', 'PR_SS
if(db %in% c('gnatsgo', 'gssurgo', 'rss', 'statsgo')) {
# CONUS
.crs <- 'EPSG:5070'
.grid <- terra::rast(nrows = 96754, ncols = 153999, crs = .crs,
extent = terra::ext(-2356155, 2263815, 270015, 3172635))
} else if(db == 'pr_ssurgo') {
# PR
.crs <- 'EPSG:32161'
Expand Down Expand Up @@ -225,6 +227,11 @@ mukey.wcs <- function(aoi, db = c('gNATSGO', 'gSSURGO', 'RSS', 'STATSGO', 'PR_SS

input_class <- attr(wcs.geom, '.input_class')

if (db %in% c('gnatsgo', 'gssurgo', 'rss', 'statsgo')) {
# TODO: HI, PR, ISSR800
terra::ext(r) <- terra::align(terra::ext(r), .grid)
}

if ((!is.null(input_class) && input_class == "raster") ||
getOption('soilDB.return_Spatial', default = FALSE)) {
if (requireNamespace("raster")) {
Expand Down

0 comments on commit 551c717

Please sign in to comment.