Tuesday, March 15, 2016

Python Script

Python Script #1

The goal for exercise 5 part three was to write a new Python script to project, clip, and load all the data into a geodatabase. 

Python is a general-purposed programming language. It is designed to have readable code and syntax that programmers can use. In our GIS II class, we used Python to  write scripts for our geodatabases in ArcGIS. For this specific assignment, we had to download multiple data and rasters to analyze Trempealeau county. We used Python for projecting the rasters into the Trempealeau geodatabase. 

Figure 1: This is a screenshot of the completed Python script 
Above is the completed Python script. The Python troubleshooting took quite a long time and tested my patience. When there were no longer any errors with the script, it was complete.

Python Script #2

The goal of exercise 7 was to write a python script to prepare the data for network analysis. Python Scripter was used to write the script. The script consisted of selecting the mines, multiple queries, and selecting by location. I used select by location to find the mines that were active, within 1.5 km of a rail system, and a mine that does not have a rail loading station on-site.

Figure 2: This is the completed Python script for exercise 7

Writing the script was frustrating, but once I got the hang of it, it was easier to write. The script was broken down into    main parts. Step one was to set up the environments and prepare for writing the SQL statements. Step two was to write three SQL statements. Step three was to create new feature from the SQL expressions. Step four was to select by location to find the number of mines that are active, within 1.5 km of a rail system, and find mines that do not have a rail loading station on-site. I found 35 mine systems that require trucking to and from their sites. 

Python Script #3

This is the last and final Python script for GIS II. I went through the same workflow as I did in ArcMap. This script created a new raster overlay based on the same criteria, but one weighted 1.5 times more than the others. I chose to weight distance from streams higher. The Python script is shown below.

Figure 3: This is the completed Python script for exercise 8



No comments:

Post a Comment