# Aggregating raster based on zones?

I'm using ArcMap 10.6.1. I have raster data and census tracts for Los Angeles. My goal is to take the mean value per census tract. I then want to aggregate all the cells in each census tract to be a single cell. So for, instance, I have a few thousand census tracts in my dataset. In the end I'll have a few thousand data points rather than the millions I end up with from 30 m^2 pixels.

I know that I can use the zonal statistics tool to get the mean per census tract. This is what I have been using, however, it keeps the cell size the same so that my analysis ultimately ends up with billions of data points (over 20 years). This is unwieldy to work with.

I thought the solution for this problem would be straightforward, but it doesn't seem to me that there's a tool that can do what I want. I tried using zonal statistics in conjunction with zonal fill, but this didn't work for me.

• Assign mean value to centroid of your polygons. May 15, 2019 at 2:10
• What license level do you have? Basic, Standard or Advanced? May 15, 2019 at 7:24
• How can you end up with a raster having one cell per census given that each census polygon has a different shape/area and that rasters are gridded, evenly-spaced pixel images? I think you're best bet is to extract the centroids of each census and assign the mean value from the raster to them (as @FelixIP suggested). May 15, 2019 at 7:31

Here is how I would do that.

This procedure will give you a point shapefile with a point in each census centroid storing the mean value of the raster in that census.

First you need to store the X and Y coordinates of each census' centroid in your census polygon:

1. open the Attribute Table of the census layer
2. Add a field and call it (e.g.) X
3. Use the Calculate Geometry on this field (right click on the name of the new field ni the Attribute Table and click "Calculate Geometry")
4. Choose "X Coordinate of Centroid" and then OK
5. Do the same for the Y, but here choose "Y Coordinate of Centroid"

Once you have the coordinate informations in the Attribute Table of your census polygons, you can extract them as a table by going in the Attribute Table options -> Export.

Now you have a table file representing only the attributes of you census layer. You can use the "Add XY Data" to create an Event Theme of the point centroids based on the XY coorindates you have just calculated:

1. Go to File -> Add Data -> Add XY Data
2. Choose the table you extracted and the X Y field in it you created and calculated previously (make sure to choose the right Spatial Reference here, it would normally be the same as your census data or the Data Frame of you map)

Now you should export the points you should see in your project as a new ShapeFile:

1. Right click on the Event Theme representing the points added to the map after using the "Add XY Data" in the Table Of Contents
2. Data -> Export Data and save it as a point ShapeFile

You can see the same procedure in more detail at this link.

Now that you have a point Shapefile representing the position of each census centroid, you need to assign it the mean value taken from the raster at each census zone.

Here I am assuming you have a Spatial Analyst license as you said you used the Zonal Statistics tool.

1. Use the Zonal Statistics tool choosing MEAN as statistics_type parameter to produce a raster with as many cells as your input raster but with values of the mean of each census in it.
2. Use the Extract Values to Points with a. your new centroid layer and the raster coming from the Zonal Statistics to create another point ShapeFile with the same points as in the centroid layer and the value of the mean found in the mean raster.