-
Currently I download mapunit polygons using |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 5 replies
-
@kevinwolz You can use the For survey area boundaries see layer You can get the CONUS and state-level gSSURGO and SSURGO Portal data on Box. https://nrcs.app.box.com/s/w0gtf7ooxqfcd0cgfht5zprcmc8qvu0i & https://nrcs.app.box.com/v/soils/folder/17971946225. At this time there is no standalone download for just the vector data analogous to the GeoTIFF MUKEY grid, you need to download the associated tabular info with the spatial. But I believe you have already downloaded the "all SSURGO" dataset, so it should be as simple as extracting and saving the mapunit polygons as a separate layer if needed. I hope the new 2023 file geodatabases should be up soon fingers crossed. We have state-level gSSURGO but not CONUS or MUKEY grids. |
Beta Was this translation helpful? Give feedback.
-
@brownag I have a quick follow up question for you on this. Per your suggestion, I downloaded the 10/1/2024 ALL_SSURGO Geopackage and pulled out the
This works great except for one thing: it returns much more data than the SDA alternative. Here are the polygons returned by And here are the polygons returned by Now I can easily process this data after it is read in to intersect it with Do you have a suggestion for a better way to read in from the local version of the database in a way that returns something analagous to |
Beta Was this translation helpful? Give feedback.
-
Yes. I'd suggest using ST_Intersects(geom, AOI) in your query to the local file. Depending on the size and frequency of queries, you are going to exceed the limits of file-based storage. Have a look at the latest update to the SSURGO Portal product, there is an "all SSURGO" option. https://www.nrcs.usda.gov/resources/data-and-reports/ssurgo-portal You will of course run into similar problems querying with the wkt_filter argument to st_read(). I've never tested, but I'd wager (a small amount) that this approach to loading small AOIs will not effectively use the spatial index. As a point of reference, a properly indexed copy of SSURGO spatial + tabular is on the order of 70GB. Suggestions:
|
Beta Was this translation helpful? Give feedback.
-
That is strange, how did you make or obtain the mupolygon table? I've never encountered this particular combination of factors. I don't use GeoPKG all that often, is there an SELECT ST_GeometryType(geometry) FROM mupolygon LIMIT 1; I just tried this in a SQLite DB and it didn't work. Maybe the client wasn't enabling the appropriate modules. I agree that CASTing anything in this database is a bad idea. Long-term, I'd recommend building or downloading a version of these data that do not store the mupolygon geometry as a MULTI- type. |
Beta Was this translation helpful? Give feedback.
-
Interesting approach. The data are massive and best imported in-pieces, usually via iteration over SSA. This is how I typically load the individual SSURGO archives into an external database. What does ogrinfo have to say about the original file? Are those MULTI geometries? If so, then we've got some splainin' to do! If the original file does not encode as MULTI, then I'd suggest querying that directly. You are probably one of the first people to download and attempt anything with one of these behemoth, all-in-on SSURGO products. Sorry for the inconvenience. Efficient storage of a vector database this large is really only possible via something like PostGIS. |
Beta Was this translation helpful? Give feedback.
-
Helpful, thanks for checking. The MULTI-feature encoding was news to me, and I just confirmed with a colleague that it was intentional. I'll follow-up as to the particular reasons. In the meantime, you might consider performing the intersection: SELECT mukey, ST_Intersection(geom, AOI) as geom
FROM
mupolygon
WHERE ST_Intersects(geom, AOI); What does that return? There are some additional optimizations that are worth trying--I use these on a regular basis in PostGIS, unsure if they work in SQLite. I completely understand the decision to work with a local copy. SDA down-time is a problem that regularly creates headaches for me when testing things late at night. I'll talk with our SDA devs about that. |
Beta Was this translation helpful? Give feedback.
-
I did some follow-up testing of single vs. multi-polygons in SSURGO. In general, expect intersection-based queries and subsets to be at least 10x slower with MULTIPOLYGON vs. POLYGON. File sizes of single vs. multi- geometry are almost the same. Seems the main rationale for using a default MULTIPOLYGON representation was render speed in Arc Pro. I'm working with the SSURGO Portal devs on more flexible options and better documentation. Due to the nature of BBOX-based spatial indexing, I can't see any reason to prefer MULTIPOLYGON representation when using the database for analytical purposes. |
Beta Was this translation helpful? Give feedback.
@kevinwolz You can use the
MUPOLYGON
layer from either the ESRI File Geodatabase or the SSURGO Portal Geopackage for CONUS. e.g.st_read("your/path/ssurgoportal/database.gpkg", "MUPOLYGON")
For survey area boundaries see layer
SAPOLYGON
.You can get the CONUS and state-level gSSURGO and SSURGO Portal data on Box. https://nrcs.app.box.com/s/w0gtf7ooxqfcd0cgfht5zprcmc8qvu0i & https://nrcs.app.box.com/v/soils/folder/17971946225.
At this time there is no standalone download for just the vector data analogous to the GeoTIFF MUKEY grid, you need to download the associated tabular info with the spatial. But I believe you have already downloaded the "all SSURGO" dataset, so it should be as simple…