-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScript-3.py
80 lines (54 loc) · 2.3 KB
/
Script-3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
# coding: utf-8
# In[6]:
# -*- coding: utf-8 -*-
"""
#Lab 3
Generated by ArcGIS ModelBuilder on : 2023-02-08 21:31:49
"""
# Question 1 and 2 are in the MS document named lab3
import arcpy
# To allow overwriting outputs change overwriteOutput option to True.
arcpy.env.overwriteOutput = True
arcpy.env.workspace = 'C:\\Users\\akunna1\\Desktop\\GEOG 592\\Lab_3\\Lab_3_Akunna\\'
# Question 3
#Section for configuring input data sources
CITIES = "CITIES.shp"
intrstat = "intrstat.shp"
# Get user's input for two highway choices
hwyListStr = input('Please type two highways to analyze- ExL I40 I80\n')
hwyList = hwyListStr.split()
hw1 = hwyList[0]
bufDistStr = input('Please input the buffer distance values here (in miles): Ex - 30\n')
for aHwy in hwyList:
# Process: Select (Select) (analysis)
intrstat_Select_2_4 = "intrstat_Select.shp"
arcpy.analysis.Select(intrstat, intrstat_Select_2_4, "ROUTE_NUM = '"+aHwy+"'")
# Process: Buffer (Buffer) (analysis)
intrstat_Buffer_4 = "intrstat_Buffer_4.shp"
arcpy.analysis.Buffer(intrstat_Select_2_4, intrstat_Buffer_4, bufDistStr+" Miles", "FULL", "ROUND", "NONE", [], "PLANAR")
# Process: Clip (Clip) (analysis)
CITIES_Clip_4 = "CITIES_Clip_4.shp"
arcpy.analysis.Clip(CITIES, intrstat_Buffer_4, CITIES_Clip_4)
# Process: Summary Statistics (Summary Statistics) (analysis)
Sum_table_2_4 = "Cities"+aHwy+'Buffer'+bufDistStr+".dbf"
arcpy.analysis.Statistics(CITIES_Clip_4, Sum_table_2_4, [["POP1990", "SUM"], ["HISPANIC", "SUM"]])
print(aHwy+ ' just being completed.')
print(' All Completed')
# Question 4
orange_durham = "orange_durham.shp"
CITIES_q4 = "CITIES.shp"
# Process: Clip (Clip) (analysis)
CITIES_Clip_q4 = "cities_clip.shp" # creating a new shape file
arcpy.analysis.Clip(CITIES_q4, orange_durham, CITIES_Clip_q4)
# Process: Buffer (Buffer) (analysis)
cities_Buffer = "cities_buf.shp" # creating a new shape file
arcpy.analysis.Buffer(CITIES_Clip_q4, cities_Buffer, "3 Miles", "FULL", "ROUND", "NONE", [], "PLANAR")
#Deleting the clipped result
arcpy.Delete_management(CITIES_Clip_q4)
#question 5
CITIES_q5 = "CITIES.shp"
# Process: Select (Select) (analysis)
cities_select_q5 = "cities_250000.shp" # creating a new shape file
arcpy.analysis.Select(CITIES_q5, cities_select_q5, "POP1990 > 250000")
# In[ ]: