Saturday, June 29, 2024

Intro to GIS Applications

 

Hello everyone! 

Welcome to the start of another course, GIS Applications, Masters edition. As a recap, I am Brandon Deusenberry and It's great to work alongside a strong group of budding GIS professionals as we tackle a new set of skill challenges. 

For the basics, I am early still early in the Masters Program, with a projected graduation of Fall '26. It cant get here soon enough! I am a full time active duty Air Force member. This July is my 21st anniversary in the service. It absolutely does not feel like it has been that long. I am a full motion video, remote sensing camera operator by trade. But nowadays my work time is more dedicated to leading and mentoring the enlisted members in my charge. I have a family with 4 crazy boys, each a different challenge, but all awesome. 

Below is a link to my story map, which has both a bit about my history and some places I have been, but also some of our recent summertime adventures. Between full time work, family time, and school, I don't have as much free time as I would like. But I still try to get together with my DnD group, and or play video games with friends where able. 

Hopefully, about the time I am done with the Master's program, I will be wrapping up my military career. From there I will combine both worlds' skills and move forward into a new one. While I can zone out and enjoy working on the technical aspects of GIS, I think I would much prefer a position that lets me help organize and lead a team of GIS professionals. But we will see what happens. 

This intro also calls for some adjectives that I think describe me, so here are those:
silly, sarcastic, gruff, calm, thoughtful, useful

But I'll let you work with me and figure out some of your own, or if those are accurate. 

My Story Map: 
https://arcg.is/00vnWC0

Sunday, June 23, 2024

Mod 6 - Geometry Processing

 Greetings all,

And just like that, this half-semester is about over. Welcome to module 6, working with geometry processes. The goals here are to explore the geometry objects associated with point, line, polygon, single and multipart features. The end deliverable and goal of the module was to create a search cursor which iterates over a river based shapefile. It then writes the associated vertex location information into a text file. It does this by utilizing a nested for loop. 

Below is a pseudo code representation of the process: 

Start

            Import Modules
                        arcpy, fileinput, string, OS, env

            Define workspace.

            Create SearchCursor for “OID”, “SHAPE@”, “NAME” within desired feature class.

            Create or Identify text file for writing results too.

            Utilize for loop to iterate through each row in cursor

                        Define VertexID for sequential vertices processing

            Utilize nested for loop to iterate through each point in row.

                        getPart() to iterate through each object.

                        Add +1 to previous point in row to continue iteration..

            Write SearchCursor output to the text file.

            Close text file.

            Delete Row

            Delete Cursor

End

The above shows the flow of the script. Note it doesnt include things like print statements designed to highlight script process. Another thing it doesnt do well is show the nested nature of the for loops. However, this is overcome with the flowchart below. 




The nested loops are more prominent above, and highlight the majority of the script processing. Aside from those loops this script is more simplistic than some of the previous, really incorporating only 3 tasks. Create a Text file, iterate over a shape file for the name, ID, and vertices information, and output it. Here is a sampler of the final output. 



For the above result we can see that the object had 25 individual features with varying amounts of vertices. But the goal was to open, write, and export that information to a shape file. Lastly, we have a snippet from the corresponding text file. 


For as simple as the process was, there are several different components to it. Its definitely amazing how far the processing and understanding of it has come in a few short weeks. Thank you much, and good luck in the next class.

v/r

Brandon







Wednesday, June 19, 2024

M5 - Spatial Processes

 Greetings all,

The scripting is getting more complex. The tools and functions being used are getting more involved. This week works with cursors, lists, and dictionaries. Specifically, using a search cursor to find particular information from a feature and then outputting that information for us to view. It is, of course, more involved than that simple sentence conveys. Multiple substeps are utilizing the principles we have built over the past five weeks. 

At its heart, this script is a series of 'for' loops that iterate over some shapefiles, then search through a particular one to pull county, city and population data. Many of the subtasks associated are incorporated into the flow chart below. The flowchart is broken into 5 different parts, with part 3 through 5 being the meat of the assignment. I likely didn't have to subdivide parts 1 and 2, but they were distinct enough to me to do so. I think part 1, environment establishment should be default in most flow charts, and what you do after that is distinct, you wont always be establishing a new file geodatabase as is the case here. Regardless, multiple things could have been incorporated or further subdivided. 



I particularly like to keep a linear flow in my chart where able. There is not any branching logic in this script. All tasks are performed subsequently to another. However, the 3 'for' loops are shown with their accompanying substeps in a square-ish loop of iterable items. It is implied that the loop will execute for each item and then continue along the linear path. 

The two images below are the culminated outputs for the different parts of the script diagramed above.



Note there are two and a half columns of named and described cities which are county seats. These outputs have been condensed into the two images above rather than kept in their original long-length format. Ultimately, as the flow chart shows, a File Geodatabase is created, then numerous features are copied into it, then a search for county seats ran on a particular feature, and finally, a dictionary is populated from those county seats. 
There were a number of scripting challenges, particularly with gathering the appropriate input data for the dictionary and selecting the right variables for the search cursor. But they were ultimately overcome. 

Thank you,

Brandon











Monday, June 10, 2024

M4 - Geoprocessing

 Greetings,

Welcome back to more adventures in scripting. This weeks emphasis is on working with Geoprocessing tools in multiple ways. Specifically, we can work with them one tool and one item at a time. Or through batch processing of a tool, or a model of multiple tools. The two primary things that were explored were the creation of a Model in ArcPro's Model Builder, and the creation of a standalone python script from scratch to execute three separate tools. The processes were as follows:

For the Model Builder: 

Take two input variables and clip one to the other. With the clip output, select particular features from the resulting data table. Then with those features selected, erase them from the previous output. The final shapefile then has removed undesireable areas from the original clip data. This leaves a shapefile filled with suitable space for other subsequent processing. 

For the Standalone Script:

There are three processes being performed. First, a provided shapefile is gaining XY coordinate data, then that output shapefile with said data gets a buffer applied. From the buffered shapefile we now dissolve the overlapping lines and create a separate standalone file from the buffered features. 

The output of which is below:


Note: I have tailored the script to include process indicators. They are a combination of print objects which highlight which process is being ran of the three, and ArcMessages which show the start and success times. Then finally, the process highlights completion. 

The script accomplishing this is the first full from scratch script that I have worked through. But don't let this idea fool you. There is a good deal of copying successful components from other scripts into this one. There was copious amounts of trial and error associated with using ArcPro Notebooks to test each segment of the script. While the script does have numerous comments to denote overall task flow it is missing some features from previous scripts. I have not incorporated some of the debugging features from the previous module. If I was worried about certain processes failing, instead of testing the script to near guaranteed success, I could have incorporated some try, except statements. 

The most serious impediment that I came across while testing involved having the Hospitals shapefile open in multiple places at once, preventing processing. For example, it cant be open in a ArcPro Map, and being modified by a standalone script in IDLE. Otherwise, it works fine, and this was a good learning point.

Thank you.

v/r
Brandon


Sunday, June 2, 2024

M3 Python Debugging and Error Handling

 Greetings Everyone,

This week saw us delving into Python script involving many more arcpy tools and purposes, but with one key twist. It was all about debugging, error handling, and script management designed to try segments of a script and provide work arounds to errors. Ultimately, three different scripts were used. The shells were all provided, and they had different end goals toward error correction. 

With errors in Python script, there are geoprocessing errors, and everything else unrelated to that. The practice and assignment worked with many of the common Python errors such as spelling mistakes, not importing appropriate modules, case sensitivity, wrong pathing, bad punctuation or indentation, and conditional assignment issues. For geoprocessing specifically, we add in workspace or environment identification issues, forgetting to check or omitting overwrite rules, multi-program data usage, and inappropriate parameters for objects being used by arc tools. 

This may sound like a lot, but the majority of the focus was on making common problems easier to identify and correct. This started with the first script highlighting some simple syntax errors. The correct out put is shown below. 





The second script involved significantly more errors, many simple fixes. But some drawing on having to cross reference the error presented in by the interpreter with data locations and objects within both the project catalog and imported data provided for the project. Its appropriate output is highlighted below. 






The third script was different. This script involved taking a known error, and applying a work around fix. The Try / Except statement was utilized to isolate the known error. This involved setting these statements, which allow the Python Interpreter to try a block of script, and upon identifying an error, provide a printout of the error and then continue with the remainder of the script. The first output below highlights this process through having the print statement that I injected as my exception, that an error has occurred, which says.... This way, the script shows that something happened, but it continued working on part B anyway, which then completed successfully. 









Continuing with the third script, and further exploring the Try / Except statement methodology, I have generated the below Flowchart. It highlights the process that I have essentially put into the script. I start part A, have a print statement acknowledging as such, then proceed to TRY a block of code. It has associated variables and a for statement for the Arc functions to work on a project file. The way that I envision this process, is that either the Try block works, or at some point an exception is encountered, which drives a separate output. Either of these paths then lead to ending part A and continuing with part B. 



Part B is not shown in the Diagram Above. It simply shows that after the process involving Part A, it would continue with the next starting point. A similar Try / Except statement can be utilized for the next block of script. Either the segment works as advertised, or the exception is there to trap it and provide a print out of what occurred instead. Thank you.

v/r

Brandon


Special Topics - Mod 3 - Lab 6 - Aggregation and Scale

 Hello and Welcome back!  My how time has flown. It has almost been 8 weeks, and 6 different labs. There have been so many topics covered in...