Module 4 Lab

 

These are the Notebook script output results from this weeks lab pt 2. These results are telling me that my script successfully ran AddXY, Buffer, and Dissolve tools to a hospitals shapefile that I had in a map on ArcGIS Pro. This was a bit of a difficult task for me. I had to sit and just consider the task at hand for a while. At first, I was just thinking about what I already had, and where I needed to get it, in terms of ArcGIS Pro tools and functions. I am pretty skilled with ArcGIS Pro, so doing these tasks would be pretty easy if I were not scripting it. However, I was trying to keep in mind not only all of the scripting language rules, but also whether I needed to use try-except statements to run through the script and catch issues. I then broke my individual tasks down and focused on each separately. First was addxy coordinates. I understand this function in Arc Pro, but how do I script it in python? I went back into my notes and the textbook and found the main command would be AddXY (). I then went through the same breakdown process with buffering and dissolving and found those commands to be Buffer () and Dissolve (). Pretty simple. I made sure to outline these in a word document so I wouldn’t have to keep going back and checking notes and stuff. Then I started to set up my script with the basics that the prompt called for me to focus on. I used previous weeks notes to script import arcpy and set my workspace path, which was pretty easy. Then I needed to overwrite the outputs. I was a bit confused at this part, and remembered an earlier week when I had an issue with my output getting an error from not doing this step. I found where I had researched the task and then implemented overwriteOutput = True in my script. Now my script was sort of “set up” to start writing the actual tasks. So I went into my word document outline and made sure to define my input and output names to avoid confusion. I also noted extra steps that I needed to implement with the tasks, such as using “management” and ”analysis” toolboxes, because I am familiar enough with Arc Pro to know that there are many types of buffers and dissolve tools. I wanted to specify so the script didn’t utilize the wrong tool. I scripted the three main tasks and tested that they worked in between each. Then I needed to do some of the steps that I wasn’t as familiar with, such as printing messages after steps and using try-except in case things went wrong. I knew i had done try-except in the last module, although I still didn’t feel super confident in this, but I thought it was worth continuing to use. So I messed with it for a little bit, making sure what I had scripted for it was going to work correctly. Once everything I had tried seemed to gel together properly, I wrote out a script in word and planned how I wanted to do my notes, such as name, date, etc. as well as notes for each task so that I could ensure I had done everything. This was a pretty lengthy process just to get to actually putting a full script together for the first time, but without having a template like in previous modules, it was the only way for me to organize my thoughts.

Comments

Popular posts from this blog

About Me

M1 Lab: Visual Interpretation

Module 3 Map Sharing and Projections