Querying NRCS Soils on the Fly
Download the Toolbox here: https://drive.google.com/file/d/1vq9KSaHnVTJh85wWmQ-BMtQfwDEjjjl1/view?usp=sharing
If you work in environmental consulting, forestry, or land management, you’ve probably used the NRCS Web Soil Survey. It’s an indispensable tool, the gold standard for accessing detailed USDA soil data.
But let’s be honest about the workflow. You go to the website (like https://websoilsurvey.nrcs.usda.gov/app/), draw your Area of Interest (AOI), click through a few tabs, generate a report, download a ZIP file, unzip it, import the shapefile into ArcGIS Pro, clip it to your actual project boundary, join the accompany data, and then finally start your analysis.
It’s a fantastic service, but it’s manual. It’s a 15-minute process for one AOI.
What if you have 50? Or 100?
This manual, repetitive task was the perfect problem to solve with a little bit of Python. We set out to create a custom ArcGIS Pro tool that could turn that 15-minute manual process into a 30-second automated one, all without ever leaving the map.
How the Script Works (And Why It’s a Game Changer)
Instead of using the click-based Web Soil Survey website, our tool speaks directly to the database behind it: the Soil Data Access (SDA) API. Think of it as using a secret entrance to get just the data you need, instantly.
The workflow with the new tool looks like this:
-
Start in ArcGIS Pro: You have your project open and a feature class of your AOI(s) (e.g., “Tract_Boundaries”).
-
Run the Tool: You open our custom geoprocessing tool. You select your AOI layer, choose an output folder, and click “Run.”
-
The Magic: In seconds, the script:
-
Takes your AOI polygons and dissolves them into a single, clean geometry.
-
Sends this shape directly to the NRCS database via its API.
-
Asks the database, “What soil map units intersect this shape, and what is the geometry of that intersection?”
-
Gets the answer back, instantly calculates the percent of your total AOI for each soil type.
-
-
The Result: The tool finishes and delivers two things:
-
A simple CSV file with each map unit, its name, and its percent coverage of your AOI.
-
A new Feature Class in a File Geodatabase, showing the soil polygons already clipped to your AOI, which it then automatically adds to your map.
-
What was a 15-minute, 10-step manual process is now a single click.
Building a “Smart” Tool: The Challenges We Had to Overcome
Connecting to an API is one thing, but making a tool truly reliable is another. The real world is messy, and so is GIS data. We had to build a resilient tool that wouldn’t fall over when it hit a weird edge case.
-
The “3D” Polygon Problem: A common headache. Your AOI might look perfectly flat, but behind the scenes, it could have hidden “Z” (elevation) or “M” (measure) values. The NRCS database (which runs on SQL Server) often rejects these “3D” shapes.
-
The Fix: Our script automatically “flattens” your geometry into a pure 2D shape before sending it, guaranteeing the API will accept it.
-
-
The “Too-Complex” AOI Problem: What if your AOI is a winding river boundary with 50,000 vertices? Sometimes, an API will time out or reject a query that is just too complex.
-
The Fix: The tool is smart. If a query fails, it assumes this might be the reason. It automatically gently simplifies the AOI’s geometry to reduce its complexity and then tries the query again.
-
-
The “No Data” Panic: What if you run the tool and get no results? It’s often because the high-resolution SSURGO data isn’t available for that specific area.
-
The Fix: We built in a “fallback.” The tool first searches for the best (SSURGO) data. If it finds nothing, it automatically re-runs the query to find the next-best-available data (STATSGO), ensuring you always get a result if one exists.
-
-
The “New vs. Old” API Problem: The API offers a modern, fast JSON format and an older, more established XML format. We found that one can be finicky where the other is stable.
-
The Fix: We added a “Use JSON” checkbox, which is on by default. But if you ever have trouble, you can uncheck it to have the tool use the super-reliable XML fallback.
-
When to Use the Web Soil Survey vs. The Script
This tool doesn’t replace the Web Soil Survey—it just complements it.
-
Use the Web Soil Survey (Website) when:
-
You have one AOI and need the full, official, printable PDF soil report.
-
You want to interactively explore soil properties and maps in a browser.
-
You are not a GIS user and just need a quick map.
-
-
Use this ArcGIS Pro Tool when:
-
You are already working in ArcGIS Pro.
-
You have multiple AOIs and want to batch-process them.
-
You just need the final map data and a % AOI table to use in your GIS analysis, and you need it now.
-
This project was a perfect example of how a little Python scripting can save hundreds of hours of manual work, transforming a repetitive chore into a simple, automated step in a professional GIS workflow.
