Python Scripts

Python

Python is a program used alongside programs like ArcMap in order to accelerate and automate geoprocessing. Not only does this help to minimize the amount of time spent running the same processes over and over again on a variety of datasets but it also helps to minimize errors caused by users. While ArcMap has its own Python script box built into the interface, PyScripter is an external program which is more user friendly. 

As a part of the course goal of GIS II, we will learn how to write basic scripts and utilize Python in ArcMap for various processes. During the course this page will be updated with new scripts we develop as well as a brief description of the purpose of the individual coding pages.

Python Script #1

The script below was used in order to project, clip (extract by mask) and load the output data into a specified geodatabase. To do so we first needed to import the list of rasters which we wanted to undergo this process in a loop. Once the process was complete for one raster, the script ran the same three tools on the other rasters in the folder until they all were loaded into the geodatabase.



Python Script #2

This script was created to select particular mines from the feature class which contained all of the mines in the state of Wisconsin. We wanted to select all the mines which were active and not attached or within 1.5 km from a railroad system to better understand which mines are using the local roads to transport their sand to and from mines. In the near future we will be conducting a network analysis to understand which roads are primarily used by these mines. 



Python Script #3

This script was used in Exercise 8 to understand the impact that various factors which need to be taken into consideration when determining where to put a main. In this particular case we used this script to add extra weight to a variable which we thought to be more important than the others. Of the 5 options (streams, farmland, residential areas, schools and wildlife areas) I gave a greater weight to residential areas because I felt that deserved greater consideration when deciding where a frac sand mine should be built. 


No comments:

Post a Comment