Sunday, May 12, 2013

Python Scripting

Introduction
Python scripting can be used to perform mapping functions in a more timely and efficient manner.  For the purpose of this project, python script was used to create a "while loop" for buffering.  This function was used to create a 1,000 meter buffer around each frac sand mine location in Wisconsin five times.

Methods
To create a "while loop" buffer for mines in Wisconsin, the following script was created:

Python Script:
>>> import arcpy
... from arcpy import env
... env.workspace = "W:\geog\CHupy\geog491_s13\HANSONLA\EX10"
... bufdist = 1000
... i = 1
... while i <= 5:
... arcpy.Buffer_analysis("Mines_Project","mines_buff" + str(bufdist) + ".shp", str(bufdist),"FULL","ROUND","ALL")
... bufdist += 1000
... i += 1
...
>>>


Results
The following figures show the results of the buffer loop created for the frac sand mine Northern Frac Sand.  The different colored rings show the five separate buffers of 1,000 meters (purple), 2,000 meters (grey), 3,000 meters (blue), 4,000 meters (green) and 5,000 meters (orange).


Figure 1: Buffer loops of 1,000 feet
(Created from python script)
Figure 2: All buffers created through python script


Figure 3: Frac sand facilities buffers & site location index
Trempealeau County, Wisconsin

The following figure displays frac sand facilities that are located within a 1,000 meter radius of a body of water.
Figure 4: Frac sand facilities within 1,000 meters of a waterbody

The following figure shows the 5,000 meter buffer around frac sand facilities in Wisconsin as well as railways.  It can be seen that many frac sand facilities are located within 5,000 meters of a railway.
Figure 5: 5,000 meter buffer, frac sand facilities & railways
Discussion/Conclusion
Python script is very useful when mapping functions require a tool to be ran multiple times for different outputs.  The python script created for this activity provided five 1,000 buffers around frac sand facilities in Wisconsin.  By writing a script, it wasn't necessary to manually run the buffer tool 5 times.  The python script took approximately five minutes to perform and output the results; this was much less time than would be required for individual tools.


No comments:

Post a Comment