GIS Programming Module 4 – Geoprocessing
Module 4 assignment involved using ArcGIS Modelbuilder and Python script that utilized multiple geoprocessing tools.
Module 4 Assignment – Part A
The first part of Module 4 assignment
was to create a model using ModelBuilder that would create a polygon feature
class containing prime farmlands inside a basin.
Modelbuilder Model
(Left) Image of basin boundary in blue overlayed on soils where red is non-prime farmland and green is suitable for farming. (Right) Image of clipped soils using basin as clip boundary.
(Left) Image of selected of all soil polygons that are non-prime
farmland. (Right) Image of soils with selected non-prime farmland erased.
Module 4 Assignment – Part B
The second part of Module 4 assignment was to write a script that uses the locations of hospitals and creates a 1000-meter buffer around the point location.
I used ArcGIS
Notebook to create and test the script.
· I started by adding the standard comments section in the first
cell of the notebook.
· The next cell contained a line of code to import arcpy which is
not needed in ArcGIS Notebooks but would be needed in a standalone script.
· I wanted all the data to be stored in a GeoDatabase so I set the
current workspace environment to the default project GeoDatabase and enabled overwrite
outputs. Enabling overwrite outputs allowed me to test the script multiple times
without the need to delete the outputs before running the script again.
· The hospital shapefile was copied to the current workspace
geodatabase. This was done since I knew that new attribute fields would be
added to the data, and I did not want to modify the original data. This made
testing the script easier since I would not have to remove the added field each
time the script was run.
· Each of the geoprocessing tools and print statements were put in
there on Notebook cell. Each cell was tested and checked before continuing to
the next tool.
· A message that the tool was running was added before each of the arcpy
geoprocessing tools. This was done because geoprocessing tools can take time to
execute, and the message would inform the user of what process is running.
· The Geoprocessing message was printed after the tool was completed.
This would print information about start and end times as well as any warnings
or errors.
· I also printed a message that the script finished.
· The ArcGIS Notebook was exported to a standalone Python script and tested using IDLE.
(Left) Image of hospital location represented as a red dot. (Right) Image of 1000-meter buffer around hospital locations. Image of dissolved 1000-meter polygons.
Image of dissolved 1000-meter polygon.
Screenshot of final output of from Python script run using IDLE.
Flow Diagram of Part B
Comments
Post a Comment