Tuesday, June 21, 2016

Geoprocessing with Python

Steps I took to make my script:
1.       I imported arcpy, set the workspace environment to the module 6 data folder, and set the overwrite output environment to true.
2.       I set the hospitals shapefile as a variable (input_feature) in order to be added to the map.
3.       I made a try statement comprised of three components. The first component adds the hospitals using the AddXY management tool with the hospitals set as the variable ‘input_feature’. The second adds a buffer of 1000 meters to the hospitals and saves the output into my results folder. The third dissolves the hospitals buffer and saves the results into my results folder. All three components get a print messages statement directly after their implementation. This shows a message that the tool ran and details about its process.
4.       Last I incorporated an except statement that would print the message “An error has occurred.” if any of the above processes fail.
This shows the flow of my script.

Here, the print statements display the messages left by the tools after running.

No comments:

Post a Comment