-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mukey.wcs()
: fix areas containing all NoData and resolution for AOI at edge of WCS extent
#306
Conversation
mukey.wcs()
: fix areas containing all NoDatamukey.wcs()
: fix areas containing all NoData and resolution for AOI at edge of WCS extent
Thanks for responding to this issue so quickly. I've been wondering lately about these edge cases. I'll do some research on how WCS can / should respond. Related TODO items
For later, some test cases # entirely outside of CONUS
bb <- 'POLYGON((-118.5392 31.4338,-118.5392 31.5660,-118.2850 31.5660,-118.2850 31.4338,-118.5392 31.4338))'
bb <- vect(bb, crs = 'epsg:4326')
mu <- mukey.wcs(bb)
plot(mu, axes = FALSE)
# single NOTCOM polygon
bb <- 'POLYGON ((-113.7389 32.2690,-113.7389 32.2772,-113.7230 32.2772,-113.7230 32.2690,-113.7389 32.2690))'
bb <- vect(bb, crs = 'epsg:4326')
mu <- mukey.wcs(bb)
plot(mu, axes = FALSE)
# all NOTCOM, multiple mukeys used
bb <- 'POLYGON((-113.6034 32.2435,-113.6034 32.2763,-113.5398 32.2763,-113.5398 32.2435,-113.6034 32.2435))'
bb <- vect(bb, crs = 'epsg:4326')
mu <- mukey.wcs(bb)
plot(mu, axes = FALSE)
# partially overlapping with CONUS border
bb <- 'POLYGON((-112.9801 31.8124,-112.9801 31.9440,-112.7259 31.9440,-112.7259 31.8124,-112.9801 31.8124))'
bb <- vect(bb, crs = 'epsg:4326')
mu <- mukey.wcs(bb)
plot(mu, axes = FALSE) |
I have added the automatic extension to the input AOI via Consider an area to the northern boundary of CONUS ("opposite" the FL keys), including a portion of Lake of the Woods County, Minnesota. Below I show results are identical to make a request that goes out of bounds, and compare with a fully in-bounds request that has been extended to the first request extent. library(soilDB)
library(terra)
# long narrow aoi, overlaps CONUS raster bounding box
aoi <- vect(ext(c(-96.1054, -94.7109, 49.3305, 52.5623)), crs = "OGC:CRS84")
res <- mukey.wcs(aoi, res = 100)
#> Request partially outside boundary of coverage source data: expected 3522 rows, received 2481
plot(res) # less long, fits entirely inside CONUS bounding box
aoi <- vect(ext(c(-96.1054, -94.7109, 49.3305, 50.5623)), crs = "OGC:CRS84")
res2 <- mukey.wcs(aoi, res = 100)
plot(res2) #> > unique(res == extend(res2, res), na.rm = FALSE)
#> mukey
#> 1 1
#> 2 NaN |
Merging this. A more generic fix may be achievable through a pattern similar to what is shown in #313 |
Fix for #304, issue raised by @kevinwolz who provided example AOI in that issue from the FL keys
Uses
terra::as.factor()
for result that has categorical representation of mukey (resolves TODO)The warnings indicate that the coverage service does not return the expected grid size. The corresponding dimension(s) out of bounds may have their resolution affected (i.e. they do not match the input
res
argument, or the other dimension)Note that the warnings are "expected" but unfortunate result of the boundary of the source raster for the CONUS gSSURGO on SoilWeb. We have most commonly encountered this issue with raster soil surveys which are of limited extent. One server side option we could implement to avoid bumping up against resolution problems frequently is increase the buffer of NoData surrounding the current extent.