Python is a free, versatile and easy to use programming language that now operates with ArcGIS and its related software. Within scripting software like PyScripter, python codes can be created to run a variety of tools. With python coding, it is possible to generate a lopping script to run multiple feature classes through a series of tools typically only accessible through ArcMap or ArcCatalog. By generating a looping script, it is possible to automate the processing of multiple feature classes. This is particularly handy when there are dozens or even hundreds of files which require processing. This even serves to prevent human error in processing. A properly constructed, automated script is far less likely to perform an error in processing over hundreds of files than a person completing the processing for each file individually. Because of this, Python scripting knowledge is a considerable asset for any working in the GIS world.
Python Script 1
The first script completed was designed to perform the initial processing on several rasters of Trempealeau County so they could be analysed (Post 3). In it, the list of rasters was retrieved from the work space folder and cued into a loop. After defining the output, each raster was put through a series of processing code. This code would reproject the rasters into the Trempealeau county projected coordinate system, taken from a county boundary shapefile in the TMP geodatabase, and then clipped to the boundaries of the same county. Afterwards, the completed outputs would be placed within the TMP geodatabase.
Python Script 2
This script was designed to select mines of certain criteria from a shapefile containing all of the Wisconsin frac sand mines, as surveyed by the DNR, and export mines meeting this criteria as its own shapefile. This selection of mines shapefile would be used to creating routing data for trucks carrying sand from the mines to available railway terminals (Post 5). Specifically, this script was designed to select all active, mine facilities lacking listed rail facilities. In addition, the script would select only the locations within the state of Wisconsin, as this was the study area, and would additionally remove all mines from the selection within 1.5 kilometers of a railway, as these locations likely have a private railway connection that is not displayed. Finally, it would save this layer selection as its own feature class and add it to the work-space geodatabase.
Python Script 3
The final python script generated for this course. In this python script, the final rasters for the streams, school parcels, residential areas, prime farmland, and wildlife areas, as retrieved from Post 6, were set up as variables in a python script. The streams raster was set up as an outweight so as to higher emphasize the importance of the areas around streams in Trempealeau county. This outweight was then added to the remaining rasters to produce a weighted impact index with a higher emphasis on the area around streams. This weighted result was then saved as its own raster.
| Pythpn Script 1 |
Python Script 2
This script was designed to select mines of certain criteria from a shapefile containing all of the Wisconsin frac sand mines, as surveyed by the DNR, and export mines meeting this criteria as its own shapefile. This selection of mines shapefile would be used to creating routing data for trucks carrying sand from the mines to available railway terminals (Post 5). Specifically, this script was designed to select all active, mine facilities lacking listed rail facilities. In addition, the script would select only the locations within the state of Wisconsin, as this was the study area, and would additionally remove all mines from the selection within 1.5 kilometers of a railway, as these locations likely have a private railway connection that is not displayed. Finally, it would save this layer selection as its own feature class and add it to the work-space geodatabase.
| Python Script 2 |
Python Script 3
The final python script generated for this course. In this python script, the final rasters for the streams, school parcels, residential areas, prime farmland, and wildlife areas, as retrieved from Post 6, were set up as variables in a python script. The streams raster was set up as an outweight so as to higher emphasize the importance of the areas around streams in Trempealeau county. This outweight was then added to the remaining rasters to produce a weighted impact index with a higher emphasis on the area around streams. This weighted result was then saved as its own raster.
| Python Script 3 |
No comments:
Post a Comment