I have created a layer of polygons with buffers around my points of interest, all of the same size, in ArcGIS. I also have a raster layer of nighttime lights with pixel values between 0 and 63 clipped to the country of interest. I would like to know how to add the average pixel value of the raster within each buffer area to the attribute table of the buffers. The attribute table of the night lights has 3 columns, the object ID, value and count.
-
1See zonal statistics– BarbarossaJul 20, 2015 at 13:47
-
I have used zonal statistics with the buffers and raster as input, and this visually gives what I'm looking for, but the output does not have an attribute table and does not allow me to build one– Gina KJul 20, 2015 at 13:52
1 Answer
You could use Zonal Statistics as Table to generate a table with a Unique ID field that can be used to join to the polygon buffer attribute table.
The tool takes
- a dataset that defines the zone (your buffer polygons),
- a zone field (some unique ID field in the buffer polygons),
- a raster that contains the values on which to calculate a statistic (your nighttime lights),
- a location for the output table.
Also, you can optionally specify which stat to calculate. Then use the "ID" field in the polygon buffer shapefile and the "ID" field in the resulting zonal stat table to perform a tabular join.
The resulting table will resemble the bottom table in this image:
The resulting table can then be joined to your polygon using the unique value (zone field) from above.
It may be necessary to add a unique ID field. Add a field to the polygon buffer and name it "ID" or something like that. Copy the UID or OBJECTID to this field using field calculator. In the zonal stat as table tool, use this "ID" field as the zone field.
-
Thanks, unfortunately to do this from the raster it does not work as it does not give location, and trying to do it with the buffer and raster creates an error. I would like to end up with buffers with average light values (the average pixel value in that area)– Gina KJul 20, 2015 at 14:57
-
1
-
-
I have used the same parameters you described above with the zonal statistics tool which does not give an error, however the output does not have an attribute table and does not allow me to build one, even though the raster is one band– Gina KJul 21, 2015 at 10:16
-