Processing Raster

3888
2
02-02-2015 02:13 PM
jaykapalczynski
Frequent Contributor

I have a question.  I have a huge raster of my state (LANDUSE raster with various categories). 

I also have a county boundary vector of each county.

1. What I want to do is clip/mask the Raster to each of the counties

2. sort of scroll through each County Record and use its geometry to run the clip/mask

3. then export each individual raster for each clip/mask. 

I figured that I could use Python to grab each of the records in the County file and then run the mask/clip.

Better yet

  1. Scroll through each of the Counties
  2. Get its geometry
  3. Run a statistics on the Raster inside the county and populate fields in the Vector Counties file
    1. I would have a field for each of the categories in the Raster
    2. The result would give the SQ Miles for each Landuse type in the specific county.

But dont know where start.  Anyone have any examples?

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

like in ZonalStatisticsAsTable ?  ‌which of course requires the Spatial Analyst Extension

0 Kudos
XanderBakker
Esri Esteemed Contributor

In this post you can see some Python code that does part of what you are looking for:

Re: Zonal statistics - percentiles

It loops through the polygons, extracts the raster for each polygon, determines statistics (in this case percentiles) and stores the result in extra fields in the polygon featureclass.

If you have any problem in adapting the code, just let me know and I will see what I can do.

Kind regards, Xander