# Zonal average weighted by distance from point

I am using ArcGIS 10.2. I have a vector layer with points, which represent houses and a raster layer with values of 0 or 1, according to a certain threshold. In a buffer of 5 km around each of these houses I want to calculate the average number of raster points above a certain thresholds (value=1), weighted according to the squared distance from the house.

Without the weighting, this would be quite simple: I would itteratively make buffers around the house (to have buffers which do not dissolve) and then use the 'zonal statistics as table' command. Now, the weighting is complicating it.

I tried the following procedure (itterating house by house in a model, see below): first rasterize the houses (point to raster) then calculate the euclidian distance, then use raster calculator to take the square of the distance and to divide my raster with thresholds by the raster with squared distances. In the meantime I make buffers around the houses, rasterize these buffers and then finally run a zonal statistics as table command to get the statistics of the output of my second rasterization within the 5000 km. Finally I use the append command to make one single table for all the houses.

Now, I have two questions:

1) Is this a good approach or am I fundamentally wrong somewhere?

2) The analysis seems to work fine, but I get strange results for some houses (eg a maximum value of 5 for one house). Moreover, if I follow each of the previous steps without a model (manually) for some houses, I get different results. I don't understand why.

Could anyone help me? Thank you whuber, that helped.

I made an ascii file to define the weights and then ran an weighted focal mean. Because it didn't work out in ArcGIS (there seemed to be something wrong with my txt file) I ran the whole process in QGIS (where the same txt file worked fine).

I thus used the r.neighbours command, which is the QGIS equivalent of the focal mean command in ArcGIS. Then I used the 'Add grid values to point' command and it worked fine. No iterations or model are needed anymore.

So let me understand...

1. Under any scenario, you run through the entire chain for each village individually?
2. You say it mostly works but has strange values sometimes?
3. That you get 'different' results when run manually..

Hard to say.... I would run through 2-3 iterations and save all intermediary outputs and check that each stage is doing exactly what you think it is. For the rows with strange values, try focusing on those. One area to look that often trips me up... make sure any raster calculator operation is executing in the data type you think it should... float or integer.

This is a single, simple operation, requiring no iteration or complicated model. You are asking for the values of a weighted focal mean of the raster layer. To carry it out, you first define a weighted neighborhood in which you place the distance-based weights (whatever they might be). Using this neighborhood, you request a Focal Mean. When that operation is complete--it tends to be quick--you then only need to extract its values at the house points, which can be done in many straightforward ways.