# NCSU GIS/MEA582:Geospatial Modeling and Analysis

## Viewshed and solar radiation analysis

Resources: ESRI virtual campus

```Create a ./Viewshed folder on your computer
Start ArcMap
```

### Viewshed Analysis

```Add the raster elev_ned
Add the point feature class fire_pt
```

Use Viewshed tool (not Viewshed 2) to compute the area visible from the fire_pt location.

```Open the ArcToolbox
ToolBox Spatial Analyst Tools->Surface->Viewshed
Set input surface to elev_ned
Set observer feature to fire_pt
Give your viewshed a name, and store it in your ./Viewshed folder
Click OK to run the analysis
```

What is the ground elevation at the fire_pt site?
In the output (viewshed) raster the visible cells are given a value of 1, while those not visible are assigned a value of 0.
How many cells are visible in this view shed?
How much area (in sq. meters) do these visible cells represent?

Rerun the viewshed, with elevation offset at the fire_pnt site at +60 m.

Add the field OFFSETA to the fire_pt attribute table.

```right mouse click on the fire_pt layer > Open Attribute Table
left mouse click on the first icon in the Attribute Table toolbar > Add Field
Type the name OFFSETA
Click 'OK'
In the Editor Toolbar (open if not visible) left mouse click on the Editor button > Start Editing
Choose the layer fire_pt and click 'OK'
In the fire_pt Attribute Table type '60' in the OFFSETA column
In the Editor Toolbar left mouse click on the Editor button > Stop Editing
Click 'Yes' to save your edits
```

Rerun the viewshed

```ToolBox Spatial Analyst Tools->Surface->Viewshed
Set input surface to elev_ned
Set observer feature to fire_pt
Give your viewshed a name, but different from the first one and store it in your ./Viewshed folder
Click OK to run the analysis
```

Now, how many cell are visible in this viewshed?
How much additional area was gained by adding the 60 m of elevation to the observer?

Rerun the viewshed again, using the +60 m observer, but this time limit your search radius to 2000m.

```right mouse click on the fire_pt layer > Open Attribute Table
left mouse click on the first icon in the Attribute Table toolbar > Add Field
Click 'OK'
In the Editor Toolbar (open if not visible) left mouse click on the Editor button > Start Editing
Choose the layer fire_pt and click 'OK'
In the fire_pt Attribute Table type '0' in the ORADIUS1 column and '2000' in the RADIUS2 column
In the Editor Toolbar left mouse click on the Editor button > Stop Editing
Click 'Yes' to save your edits
```

Rerun the viewshed

```ToolBox Spatial Analyst Tools->Surface->Viewshed
Set input surface to elev_ned
Set observer feature to fire_pt
Give your viewshed a name, choose a different namet one and store it in your ./Viewshed folder
Click OK to run the analysis
```

How many cells are visible in this viewshed? How much ground area is visible?

Restrict the search area to an annulus 1000 m wide (from 1000m to 2000m) and restrict the search azimuth to the arc from NE (45 deg) to SE (135 deg).

```add two fields: AZIMUTH1 and AZIMUTH2 (as doubles) to the fire_pt Attribute table (see instructions above)
Start editing (see instructions above)
and populate: AZIMUTH1=45, and AZIMUTH2=135.
```

Rerun the viewshed (see instructions above)

How many cells and area are visible now?

To expand our repertoire a bit, let's next add our own data, but instead of a single point, let's add a pair to the project
(so that you know how to do this) and run one more (just one, I promise) viewshed analysis.

You can do this with any point data you wish, but if you don't have one handy,
here's the coordinates (in NC State Plane NAD83) for Red Hat's Headquarters over on Centennial Campus:

```x=638898 and y=224528
```

And for Jordan Hall on Central Campus:

```x=638887, y=225365.
```

Put these values into a text file (use e.g. Notepad but avoid MS Word). and save the file in a known location (with the extension .txt)
Your text file should look something like this:

```X,Y
638898,224528
638887,225365
```

```Add XY Data. (File->Add Data->Add XY Data...)
browse for your saved .txt file
Set 'X Field' to 'X' and 'Y Field' to 'Y'
Click 'OK'
Click 'OK' for the warning
```

Convert it from the resulting event to a shape file.

``` right mouse click on the .txt Events
Data > Export Data
save in the ./Viewshed folder and click 'Yes' to add the layer to the project
Open the Attribute Table of newly created shapefile
Add the fields OFFSETA, VERT1, VERT2, AZIMUTH1, and AZIMUTH2.
Populate (in the editing mode)
point FID=0:
OFFSETA=35m, VERT1=12, VERT2=-12, AZIMUTH1=300, AZIMUTH2=60.
For point FID=1:
OFFSETA=40m, VERT1=12, VERT2=-12, AZIMUTH1=150, AZIMUTH2=240.
Save the edits

```

Run a viewshed on your new data with these attributes. For an observer standing atop the Red Hat Building, what do you think that this view shed result represents?
Can the observer see Jordan Hall on the NCSU Central Campus?
Do you think an observer standing atop Jordan Hall could see his counterpart on the Red Hat Building?

Perform solar radiation analysis in Spatial Analyst:
```Display the Arc Toolbox.
Select Geoprocessing->Environments.
Under Workspace set the Current Workspace to point to the ncrast,mdb geodatabase
```

Compute the incident solar radiation for the summer solstice (day number=172)

```Spatial Analysis Toolbox > Solar Radiation > Area Solar Radiation
use elev_ned for the input raster
Set the output raster = ned_solar172
Set the latitude = 35.7716 (~for Raleigh, NC)
Set the Time Configuration to Within a day
Set the Date/Time settings-Day number of year to 172
the remainder of the fields can be left at their default values.
```

Repeat the above steps to generate a incident solar radiation raster for the winter solstice (day number=356).
Note: the computation can take some time.

What are the data units for the resulting incident radiation maps?

Determine the difference in radiation energy between the two solstice extremes by differencing the two radiation rasters just created.

```Spatial Analyst > Map Algebra > Raster Calculator
Set output to solar_diff
In the calculator's expression field type:
"ned_solar172" - "ned_solar356"
```

Change the color ramp to one that emphasizes contrast in the difference raster.
Where do you see the greatest differences in insolation between summer and winter?
Where does the least difference in annual insolation occur?
Do these differences make sense? Explain.