Mast head image

Geometric Intersect with SSURGO Data Tables

This script intersects a triangular area of interest (AOI) and returns two tables.

It extracts all the intersected polygons and returns polygon data in the first table and aggregated area data in the second table.


Text highlighted in yellow in the example script can be changed for an AOI geometry.

Tips Page

Copy the example script below and paste it into the query box on the Soil Data Access page.

Soil Data Access Query Page

Example Script

~DeclareGeometry(@aoi)~

SELECT @aoi = geometry::STPolyFromText('polygon((

-121.157072910308 46.0181639308995,

-121.321280753631 45.9248106152548,

-121.348997869021 45.9168439802811,

-121.157072910308 46.0181639308995))', 4326)

~DeclareIdGeomTable(@intersectedPolygonGeometries)~

~GetClippedMapunits(@aoi,polygon,geo,@intersectedPolygonGeometries)~

~DeclareIdGeogTable(@intersectedPolygonGeographies)~

~GetGeogFromGeomWgs84(@intersectedPolygonGeometries,@intersectedPolygonGeographies)~

SELECT id, SUM(geog.STArea()) AS area

INTO #aggarea FROM @intersectedPolygonGeographies

GROUP BY id;

SELECT mukey AS MUKEY, area AS Area, musym AS Map_unit_symbol, nationalmusym AS National_symbol, areasymbol AS Area_symbol, mucertstat As Certification_status

FROM #aggarea A, mapunit M, legend L

WHERE A.id = M.mukey AND M.lkey = L.lkey

ORDER BY id;

SELECT id AS mukey, area FROM #aggarea

Examples Table Output

MUKEY Area Map_unit_symbol National_symbol Area_symbol Certification_status
76183 450931.751630753 159B 2k8j WA639
76184 28054.5407755375 159C 2k8k WA639
86603 24981.4040058702 1561 2x3n WA676


MUKEY Area
76183 450931.751630753
76184 28054.5407755375
86603 24981.4040058702



Helping People Help the Land

USDA is an equal opportunity provider, employer, and lender.