Tuesday, March 14, 2017

Python Scripts

  Python is used in GIS to help run analysis tools. Although usually used to create procedures for large data sets, in the section(s) below, python will be used to demonstrate an understanding of some of the more basic uses of python.

Use a Loop to Define, Project, and Extract Rasters.
  Figure 2.0 shows a screenshot of the python script which is associated with the post Data Gathering. This python script uses a loop to project the rasters (DEM, Landcover, and NASS), to define the outputs, and to create a copy of the rasters into the Trempealeau county geodatabase. The image will enlarge when clicked upon.

Fig 2.0: Loop to Define, Project, and Extract Rasters

























Select Mines
  Figure 2.1 is the python script that was used for the lab Network Analysis of Frac Sand Mines to query out the mines which will use trucks to transport sand from the sand mine to the rail depot. It is assumed that if a sand mine is located within 1.5 km of a depot that a rail spur has already been created and that the map data is out of date. There are three criterion which the query will be based upon:
                                                           1. The mine must be active
                     2. The mine must not have a rail loading station on-site
              3. The mine must not be within 1.5 km of a rail line
Fig 2.1: Queries, selects, and creates a new layer for the sand mines whose trucks will have an impact on local roads.

Give Weight to a Raster
  This python script shown below in figure 2.2. gives 2x the weight to the Erodable raster while all of the other rasters remain unchanged.  It also adds the input rasters together. This script is associated with the Determining Sand Mine Suitability With Raster Analysis blog. The weighted script was not used as part of the analysis in that lab however. The script's purpose is to demonstrate how a raster could be given a higher weight if it were thought to be more important.

Weighting a Raster
Fig 2.2: Weighting a Raster

No comments:

Post a Comment