Making this python script was part one of exercise seven. In exercise seven we are looking at the effect commercial trucking has on roads from mines to rail stations. To do an analyze of this question we first need to get rid of the mines that have rail spurs and the mines that are not active. To do this we used python to make a query and acquire our specified results.
The first step was to set the environments for the script and import the system modules. The workspace was set to our individual exercise seven geodatabase. The next step was set the variables we would be using in the script, which were just existing feature classes in the geodatabase, as well as some new ones that we would be creating. The third step was to create three SQL statements that would query out the mines that we wanted. The first SQL statement selected the active mines, the second statement selected all of the facilities with "Mine" as a type, and lastly the third statement kept out any mines with the word "Rail" in them. The SQL statements were then ran with the addition of the variables created earlier. The last step was to remove active mines that were within 1.5km of a railroad. Any closer distance and they likely would have had a spur built to the railroad. To do this the arcpy.SelectLayerByLocation_Management tool was used. After those parts of the script were done and the script successfully ran, the result was a point feature class containing 41 mines.
Figure 1. The python script used to query active mines with no railroads in a 1.5km radius. |
No comments:
Post a Comment