-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCountVectorsAndRasters.py
More file actions
48 lines (39 loc) · 970 Bytes
/
Copy pathCountVectorsAndRasters.py
File metadata and controls
48 lines (39 loc) · 970 Bytes
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
import arcpy
mxd = arcpy.mapping.MapDocument("N:\\GIS Programming\\Activity3.mxd")
print mxd.filePath
layerlist = arcpy.mapping.ListLayers(mxd)
numlyr = len(layerlist)
print "There are ", numlyr, "layers here"
for eachlayer in layerlist:
print eachlayer.name
first = layerlist[0]
print first.name
last = layerlist[-1]
print last.name
try:
print first.contrast
except:
print "oops"
print first.visible
print first.isFeatureLayer
print last.isFeatureLayer
print last.isRasterLayer
desc_first = arcpy.Describe(first)
first_fields = desc_first.fields
for f in first_fields:
print f.name
if first.isFeatureLayer:
print "it is vector"
else:
print "it is raster"
vnum = 0
rnum = 0
#start the FOR loop
for lyr in layerlist:
if lyr.isFeatureLayer:
vnum = vnum + 1
else:
rnum = rnum + 1
#end the FOR loop
print "There are", vnum, "vectors"
print "there are", rnum, "rasters"