I have a raster image of a road network with pixel values corresponding to vehicule frequency.

enter image description here

What I would like is to calculate a weighted distance raster with the frequency as weight within a maximum distance. I don't seem to grasp the concept of how to reference neighbouring cell values.

How do I refine and apply a formula like the following or better in the raster calculator AND / OR how can I make Focal Statistics work with a weighting formula?

newraster(x,y) = 
     for all i in range(-maxdist, maxdist):
        for all j(-maxdist to maxdist):

you need a bit of work outside of ArcGIS to create a custom kernel that you will use with focal statistics (NbrWeight). The kernel will be store in a text file.

The inKernelFile is an ASCII text file that defines the shape of the neighborhood and the weight of each cell in that neighborhood. A value of 0 for a cell position indicates that the cell is not a member of the neighborhood, and a number at a corresponding cell's position indicates that the cell value be included as a member of the neighborhood. The nonzero value will also serve as the weight to multiply the corresponding cell value 

So, in your case, here is an example of kernel for max dist = 2 (yes, I am lazy).

3 3 
0.293 0.5 0.293 
0.5 1 0.5 
0.293 0.5 0.293 

When distance = 2 (or more) the weigth = 0 When distance = 1, the weight = 1-1/2 = 0.5 when distance = sqrt(2) (on the diagonal), the weight = 1-1/sqrt(2) ~= 0.293

if you add a print in your script, you'll see all the values for a given maximum distance (in pixel).

  • i ended up creating kernels through python which turned out to be the best solution. thanks!
    – bountan
    Dec 7 '20 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.