In the third module for this course we were able to apply some of the python skills we've been working on to shape and manipulate data in ArcPro. The base concepts: code being a flowchart of processes, debugging strategies, how to identify file paths for python and ArcPro, all came to bear when we created custom toolboxes in the exercise and added new tools to them as Models, then wrote code for geoprocesses in python script.
Models are a visual representation of the coding for a geoprocessing tool, and in Arc they can be manipulated to build custom tools, and run specific processes outside of the preset tools provided in the ArcPro user interface. Models allow the user to specify inputs and outputs in a visual format, run multipart processes with sequential outputs as one "call" and to customize the flow of a process with SQL clauses and unique arguments. All of these abilities are also available in python of course, as the models are just representations of the python backbone, but the visual display of the model is especially helpful for keeping track of different inputs and outputs.
In the lab for Module 3 we worked entirely without the visual display to build our code. From experience it was easy to import the needed modules, set the workspace, and specify the settings I wanted arcpy to follow for my tools. From there, it was great practice to use the ArcPro reference pages that ESRI creates to build the code I needed to complete the assignment. These info pages are an incredible resource for getting the most out of the powerful tools ESRI has already created, and while the python code is provided on the page, it does take a little bit of implementation and background knowledge to call the correct variables and check for syntax errors. I say for the fourth time this year: check your classes.
Wheel, Invented & Explained: The info pages ESRI provides on their geoprocessing tools are highly valuable for someone calling these tools in python script. |
The lab assignment asked us to write a code that would run the Add XY tool on a shapefile -effectively returning a series of points- and then use Buffer on each of those points to create a 1000 meter perimeter, and allow any overlapping perimeters to combine as one shape. By calling the AddXY and Buffer + Dissolve geoprocessing tools, the script created a shapefile that in the real world could be used to highlight areas around hospitals.
Dots to Paper: The visual output of the shapefile we modified is information that could be used by city planners, emergency services, or property owners. |
- Model builder is great for quick custom tools or tool modifications within Arc
- You won't be able to add or edit tools in the default ArcPro toolbox, so make a different one for custom tools
- If you're running a tool or code multiple times, make sure you've allowed Arc to overwrite outputs
- C h e c k y o u r c l a s s e s
- ESRI reference pages let you see the full extent of a premade tool, as well as formatting guidelines
- Good commenting habits will (continue) to save you from having to retype a buggy code over and over while you debug
- (' ') or (" ") work to signify when there is an optional parameter in the line but you don't need to use it
No comments:
Post a Comment