Python Scripting

For my GIS mapping course at UW-Eau Claire, our class was given the assignment of creating Python script to be ran in ArcMap. The project in question was to build a suitability and risk model for sand mining in Trempealeau County, Wisconsin. To do so, data was downloaded from different sources on the internet and imported into a self designed geodatabase. To manipulate and edit this data, python script was used.

Figure 1.1. Python Script for exercise 5 of the UW-Eau Claire, GIS 2 mapping class. (17/03/2016)

In the script above, the first step was to assign a work space, or a folder connection to work in. Then, a CheckOutExtension was scripted to allow licensing for use of ArcMap tools. The purpose of this script was specifically meant for editing the raster data from exercise 5, so the list of them was scripted using the ListRaster function. Once the rasters were all accounted for, the Project Raster tool was used to project all of them to the same Coordinate System. The final part of the script was based on clipping the raster data to fit that of Trempealeau County. This was done by using the extract by mask tool. Once script was verified and it was ran in ArcMap and used in the final construction for the maps.

Python Scripting for Network Analysis

To continue with the sand mining theme in Wisconsin, the UW-Eau Claire GIS 2 class was asked to look at sand mine transportation networks, specifically road impact, through the state. However, before this analysis could be accomplished, a process of narrowing down the mines to the area of study needed to be done. This was done by writing a few lines of command through PyScripter, and can be viewed in figure 1.2.


Figure 1.2. Python Script for exercise 7 of the UW-Eau Claire, GIS 2 mapping class. (4/15/2016)


The final mines selected had to follow the listed criteria below:

  • All mines must be withing Wisconsin's boundaries. 
  • The mine must be active.
  • The mine must not have a rail loading station on-site.
  • Eliminate any mines that are within 1.5 km of the railroads.
From these lines of command a total of 44 mines were selected from an initial 129, and two new feature classes were saved in the projects personal geodatabase; "mines_norail" and "mines_norail_final".

Python Scripting for Raster Analysis


Comments