I have an issue that feels like it should be simple but I cannot for the life of me figure it out.

In the image below I have calculated a viewshed for the selected point. What I need to do is assign a value to the raster cell below the point, depending on how many cells that can be seen from that point.

(x if <50% of cells within the small radius can be seen; y if >50% of cells within the small radius but <50% of cells within the outer radius can be seen; z if >50% of cells within the outer radius can be seen)

In short, I need to calculate viewshed from a raster cell rather than a point and simultaneously assign a value to the cell. This would ideally be done through some form of moving window analysis as I need to do this for pretty much every cell in the raster. It feels like it shouldn't be this hard so if there's an obvious solution, feel free to call me an idiot and give me the answer! :) enter image description here

  • 1
    Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Feb 28, 2023 at 17:03

1 Answer 1


I think you should be able to do this fairly easily with the Raster Calculator using a combination of Conditional statements and the Focal Statistics tool. Since your values for visible/not visible are 0/1, the average value in a given radius around a cell should be > 0.5 if more than half the cells can be seen.

You may have to tweak this a little, but try something like this:

Con(FocalStatistics("Viewshe_nh_61_2m", NbrCircle(small_radius_value, small_radius_units),"MEAN") < 0.5, value_x_if_true, Con(FocalStatistics("Viewshe_nh_61_2m", NbrCircle(large_radius_value, large_radius_units),"MEAN") < 0.5, y_value_if_true, z_value_if_false)) 

Basically, this is saying:

  1. If less than 50% of cells are visible in the small radius (specifying value and units) assign value x to that cell.
  2. If more than 50% of cells are visible in the small radius (i.e., the first condition is false), execute the second conditional statement instead.
  3. If less than 50% of cells are visible in the large radius, assign value y. If more than 50% of cells are visible (i.e., the first and second conditions are false), assign value z.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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