Wednesday, June 21, 2017

GIS Programming 5103 Module 5 Geoprocessing

This week we are working on geoprocessing in ArcMap with python. Learning how to batch a single tool for multiple files is a great time saver and I'm excited to utilize model builder to apply multiple tools to a map using various files at once, this could speed up things like clipping and buffering files. I like working with the toolboxes, there is no limit to what can be done in ArcMap.
For the lab we made our own toolbox and used a tool in Modelbuilder and set model parameters. Below is my model that clips, selects, and erases by selection. Then we exported a Python script from Modelbuilder and used it outside of ArcMap and then created a script tool. I  had a lot of trouble with my filepath within the scripts, but learning to overwrite outputs was very handy. Then, we created a script tool and shared the toolbox.
My model results are below and a screenshot of the clipped and erased file, you can see the green clipped soils file has parts erased.
My favorite part was using model builder, although the lab didn't cover the details, I used ESRI's online help tutorials to make sure I was dragging tools to the model and setting up toolboxes and parameters correctly. I really liked that you can automate processes so easily and I am looking forward to using this new skill at a later time.
I tried the model this way, too:







Applications in GIS 5100 Module 4 Visibility Analysis

   This week we are working on Visibility Analysis using DEM files and an observation point to look at view sheds (A) or line-of-sight analysis(B). This is useful to find visible areas or lines of sight for utilities and lets you account for urban, geological, vegetation and other obstructions in the terrain to build a model. The videos in class showed a fan of light going over a skyscraper clad coastline, that's a good way to think about line of sight. We also read about Isovist analysis which is vector based as opposed to the raster based types listed above (A,B).
    In my discussion I proposed using this for a different application, for tracking the amount of sun in hours for a season and a place like summer in my garden, but this could be broadened to commercial agriculture and farming and be very useful.
    For lab we used the 3D and Spatial Analyst Extensions to perform view shed and sight analysis with a DEM. Then we prepared Lidar data and created a profile graph for the line of sight analysis and adjusted offsets and viewing angle to look at the parameters used in visibility analysis. We looked at the view sheds for fire towers, added cameras to Boston and looked at the amount of terrain visibility from Yellowstone roads and then we looked at constructing lines of sight for summits and comparing the 3D analyst extensions for view shed and visibility. 
    I found that the view shed  tool gave me fewer visible areas for my summits but was probably more accurate because it looks at the elevation and observer features where the visibility assumes any height above ground is visible. The results of both are shown below with the yellow areas being visible according to the view shed tool and pale green is visible according to the visibility tool.
Here are my maps:
Yellowstone visibility from roads map with campgrounds shown as green triangles.
  


 Here are my summit lines of sight with the Pillar Peak lines in red, the summits are green dots, and the yellow areas are visible from the view shed tool and the green are from the visibility tool.

Here you can see my 3 camera icons and the purple shows areas visible from the cameras with a buffer around the yellow finish line dot in the center, the blue spots are also visible areas from my cameras and cover less area than the purple.

Here the 3 fire towers are in green, summits are blue dots and the visible areas per fire tower are color coded by the tower, in res, yellow, and blue. This is not a finished map, just a screen shot showing my work in progress from step A.

Wednesday, June 14, 2017

Applications GIS 5100 Module 3 Watersheds

    This week we looked at watersheds, flow analysis, and how to map directional flow. We used the spatial analysis toolbox to create many files like flow direction and accumulation rasters, pour points, watersheds (shown here in pastel multi-colors), and then then we added stream and gage station (yellow dots) vector files.


    Finally, we made our own pour point (green dot) and made a watershed around just that point and compared it to the other watershed we created. We did stream and watershed delineation and processed our DEM so that the flow rasters we created later would not have sinks that would impede water flow.


    I had a little trouble getting my pour point to make a reliable watershed, so I had to make a new feature class again. The new watershed for this point is shown in green with a blue dot for the actual point. I used both raster calculator and batch calculate statistics to get total areas for the two watersheds shown, from there you can just subtract one or the other to see the difference. The rest of the project went great and you can easily see what water would do on this Island with the data created from the GIS tools.










Monday, June 12, 2017

Programming 5103 Module 4 Debugging

In this week's module we worked on using debugging and error messages to correct our scripts in Python. We looked at syntax errors and exceptions, debugging steps and then used the try-except method to handle exceptions in script writing. Luckily it is quick and easy to check for errors, it is not always easy to understand what they mean and how to fix them. I get lucky and just have an indention error that is obvious after getting the red error message, but this week we worked on slightly harder issues to troubleshoot. ListFields is handy because it gives you a list of all field objects. Running a script in the PY window also gives you a debugging option that you can apply to the script that you are trying to run. I had to use ESRI online help and Stack Exchange and hit a lot of attribute errors and object errors in my string in script 2 and got the first half of the script to print fine but had issues getting ListLayers to work. Below are my 3 script results. It was fun when they did work and the de-bugger tool is a great asset, I have a lot to learn about using import and what keywords work in Python, but it is fun to start understanding what is needed to write code.





For script #3 , above, I added an extra print line to see where my invalid mxd line was, so it prints parks to let me know the issue was not in part A but in part B, since both had a file path.


Below is my Flowchart showing the basic process for script 3.