I am working with the 3D analyst viewshed command seeking to generate and sum AGL outputs for large numbers of viewpoints.

2602
6
06-03-2016 06:26 AM
MarkGillings
New Contributor

The aim is to generate total AGL maps for all conceivable viewpoints in a given area (i.e. DEM) - this is frequently in the order of 10s to 100s of thousands of points. To do this I have written a Python script but I am hitting a problem with the chunk of code that iteratively combines the individual AGL rasters into a single output.

The script takes as input a vector viewpoint layer and a DEM and it seems to work insofar as it loops as it should and generates a final output. However comparison with a manual 'testbed' dataset generated for a small sample of points reveals that the resultant values do not match. Trials with single points worked fine (i.e. for a single point the resultant AGL layer generated by the script was idennitcal to one manually generated) but in the case of two points the output seemed to be the sum of the 2nd AGL raster twice (rather than AGL1 + AGL2). I created a debug version of the code using elif for a small number of points and saving the temporary raster each time with a unique filename and it worked fine - the AGL layers generated at each iteration matched the manual versions as did the final AGL output. However, this is not really practical for 100K+ viewpoints.

If anyone can advise I would be deeply grateful - I am a very amateur python coder (as will become painfully clear & apologies for in advance for any violence done to programming language) but I'm giving it my best shot.

Attached is the python script as intended (hideAGLv8.py) and the debug version for 3 points (using elif) that does actually work for those 3 points insofar as it generates the expected output (hideAGLv4.py).

Cheers - Mark Gillings (UK Archaeologist)

0 Kudos
6 Replies
MarkGillings
New Contributor

ArcGIS 10.3

0 Kudos
DanPatterson_Retired
MVP Emeritus

Could you provide an image of the study area.  I am still having trouble figuring out why you would need to have so many observer points or viewpoints.  What options have you tried and ruled out to simplify the complexity of the problem?

0 Kudos
MarkGillings
New Contributor

Hi Dan

It is to generate the equivalent of a Total Viewshed map of an entire landscape (i.e. cumulative views from all possible view locations) but using AGLs instead of viewsheds. It’s effectively a way of mapping the overall affordance of a given landscape to seeing (and being seen) independent of any specific location. I'm generating a location-independent map of degrees of hiddeness. I’ll gladly email you a copy of the research papers that explain the rationale. 

cheers

mark

0 Kudos
DanPatterson_Retired
MVP Emeritus

my email is on my profile page, it is my university address so I have access at all times.  I would be interested in seeing this and seeing how it can be scaled, if at all.  Thanks

0 Kudos
TimothyHales
Esri Notable Contributor

I am trying to better understand what you are trying to accomplish. My GIS is a little rusty, but it's my understanding that the Viewshed tool takes all of the points and creates an output layer that shows which areas can be seen. Those cells that can be seen by more points have a larger value. I don't see a need to loop through each individual record, then add the output raters altogether.

0 Kudos
MarkGillings
New Contributor

HI Timothy

You can indeed generate a cumulative viewshed using the standard tool but not (as far as I have been able to determine) an equivalent cumulative AGL layer - hence the need to loop and sum. 

cheers

mark

0 Kudos