Skip to content
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

SDA_spatialQuery: implement what 'mupoint', 'muline', 'featpoint', 'featline' #346

Merged
merged 2 commits into from
Apr 18, 2024

Conversation

brownag
Copy link
Member

@brownag brownag commented Apr 18, 2024

Addreses SDA_spatialQuery() portion of #342

library(soilDB)

# get bounding box for MI606
b <- fetchSDA_spatial("MI606", geom.src = "SAPOLYGON", method = "bbox")
#> Using 1 chunks...
#> Chunk #1 completed (n = 1; 0.5 secs)
#> Done in 1 secs; mean/chunk: 0.5 secs; mean/symbol: 1.02 secs.

# spatial query for all mupoint
SDA_spatialQuery(b, what = "mupoint")
#> Simple feature collection with 239 features and 1 field
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -89.22762 ymin: 47.8895 xmax: -88.33466 ymax: 48.23765
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>      mukey                       geom
#> 1  1717983  POINT (-88.91737 47.8895)
#> 2  1717983   POINT (-88.91245 47.891)
#> 3  1717983   POINT (-88.9111 47.8914)
#> 4  1717983  POINT (-88.9083 47.89412)
#> 5  1717983 POINT (-88.90718 47.89434)
#> 6  1717983 POINT (-88.90579 47.89568)
#> 7  1717983 POINT (-88.90421 47.89617)
#> 8  1717983 POINT (-88.90303 47.89652)
#> 9  1717983 POINT (-88.90257 47.89666)
#> 10 1717983 POINT (-88.90217 47.89675)

# spatial query for all muline (NULL)

# get bounding box for CO662
b <- fetchSDA_spatial("CO662", geom.src = "SAPOLYGON", method = "bbox")
#> Using 1 chunks...
#> Chunk #1 completed (n = 1; 0.1 secs)
#> Done in 0.3 secs; mean/chunk: 0.1 secs; mean/symbol: 0.25 secs.

# spatial query for all muline
SDA_spatialQuery(b, what = "muline")
#> Simple feature collection with 178 features and 1 field
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -107.4217 ymin: 38.01809 xmax: -106.5597 ymax: 38.7517
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>      mukey                           geom
#> 1  3084846 LINESTRING (-106.9299 38.49...
#> 2  3084846 LINESTRING (-106.9209 38.47...
#> 3  3084846 LINESTRING (-106.8675 38.42...
#> 4  3084846 LINESTRING (-106.8667 38.40...
#> 5  3084846 LINESTRING (-106.8886 38.42...
#> 6  3084846 LINESTRING (-106.8983 38.49...
#> 7  3084846 LINESTRING (-106.8983 38.49...
#> 8  3084846 LINESTRING (-106.9297 38.50...
#> 9  3084846 LINESTRING (-106.8182 38.41...
#> 10 3084846 LINESTRING (-106.8055 38.42...
         
# spatial query for special features

# get bounding box for CA649
b <- fetchSDA_spatial("CA649", geom.src = "SAPOLYGON", method = "bbox")
#> Using 1 chunks...
#> Chunk #1 completed (n = 1; 0.1 secs)
#> Done in 0.3 secs; mean/chunk: 0.1 secs; mean/symbol: 0.26 secs.

# spatial query for all featline
SDA_spatialQuery(b, what = "featline")
#> Simple feature collection with 400 features and 1 field
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -120.3974 ymin: 37.18133 xmax: -119.9022 ymax: 37.72812
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>    featkey                           geom
#> 1   292333 LINESTRING (-120.0193 37.26...
#> 2   287230 LINESTRING (-120.2864 37.42...
#> 3   292331 LINESTRING (-119.9038 37.49...
#> 4   287231 LINESTRING (-120.3636 37.42...
#> 5   287230 LINESTRING (-120.3503 37.45...
#> 6   287230 LINESTRING (-120.3663 37.50...
#> 7   287231 LINESTRING (-120.2938 37.40...
#> 8   287231 LINESTRING (-120.1897 37.20...
#> 9   292333 LINESTRING (-120.368 37.613...
#> 10  287231 LINESTRING (-120.2201 37.23...

# spatial query for all featpoint
res <- SDA_spatialQuery(b, what = "featpoint")
plot(res)

Closes #342

@brownag brownag self-assigned this Apr 18, 2024
@brownag brownag merged commit a471279 into master Apr 18, 2024
5 checks passed
@brownag brownag deleted the SDA_spatialQuery-features branch May 6, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fetchSDA_spatial/SDA_spatialQuery: add support for point/line mapunit and feature point/line geometry
1 participant