-
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
alignment of WCS results with authoritative grid topology #313
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…d topology for CONUS
It is awkward that HI and PR have a non-integer origin. If that is correct @dylanbeaudette I think this should resolve #307 for the time being |
dylanbeaudette
approved these changes
Nov 3, 2023
Meant to post this here: OK, new HI and PR grids created, and pushed to the WCS servers. Here are the source grid specs: HI
PR
|
Great! I now get: library(soilDB )
library(sf)
#> Linking to GEOS 3.11.2, GDAL 3.6.2, PROJ 9.2.0; sf_use_s2() is TRUE
library(terra)
#> terra 1.7.55
# paste your BBOX text here
bb <- '-65.7741 18.1711,-65.7741 18.3143,-65.5228 18.3143,-65.5228 18.1711,-65.7741 18.1711'
# convert WKT string -> sfc geometry
wkt <- sprintf('POLYGON((%s))', bb)
x <- st_as_sfc(wkt, crs = 4326)
# query WCS
mu <- mukey.wcs(x, db = 'pr_ssurgo')
# make missing data (NA; the ocean) blue
plot(
mu,
legend = FALSE,
axes = FALSE,
main = attr(mu, 'layer name'),
colNA = 'royalblue'
) mu
#> class : SpatRaster
#> dimensions : 532, 888, 1 (nrow, ncol, nlyr)
#> resolution : 30, 30 (x, y)
#> extent : 269705, 296345, 237495, 253455 (xmin, xmax, ymin, ymax)
#> coord. ref. : NAD83 / Puerto Rico & Virgin Is. (EPSG:32161)
#> source(s) : memory
#> varname : file40245a7534fd
#> categories : mukey
#> name : mukey
#> min value : 326853
#> max value : 3349461
# paste your BBOX text here
bb <- '-159.7426 21.9059,-159.7426 22.0457,-159.4913 22.0457,-159.4913 21.9059,-159.7426 21.9059'
# convert WKT string -> sfc geometry
wkt <- sprintf('POLYGON((%s))', bb)
x <- st_as_sfc(wkt, crs = 4326)
# query WCS
mu <- mukey.wcs(x, db = 'hi_ssurgo')
# make NA (the ocean) blue
plot(
mu,
legend = FALSE,
axes = FALSE,
main = attr(mu, 'layer name'),
colNA = 'royalblue'
) mu
#> class : SpatRaster
#> dimensions : 540, 881, 1 (nrow, ncol, nlyr)
#> resolution : 30, 30 (x, y)
#> extent : 61342, 87772, 345515, 361715 (xmin, xmax, ymin, ymax)
#> coord. ref. : NAD83(PA11) / Hawaii zone 1 (EPSG:6628)
#> source(s) : memory
#> varname : file402415803d8
#> categories : mukey
#> name : mukey
#> min value : 467795
#> max value : 467929 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a proof of concept I use
terra::align()
to adjust results based on known dimensions and extent of the complete CONUS/EPSG:5070 30m data sources.