Python and ARCPY
Python and ARCPY
With ArcGIS
Lecture 10
GIS System
ArcObjects
env.workspace = "C:/Temp"
env.workspace
arcpy.Clip_arc()
arcpy.Clip_analysis()
env.workspace = "c:/basedata/roads.gdb"
arcpy.Select_analysis("nfroads", "paved", '[ROAD_CLASS] = "PAVED"')
Python uses forward slashes, different than Windows using back slashes
Python Basics
gdbPath = "C:/SouthAfrica.mdb"
fc = "Roads"
fullPath = gdbPath + "/" + fc
Variable index
Word =
Word[0]=H
Word[2:4]=lp
Word[:3]=Hel
Word[-2:-4]=el
Word[-3:]=lpA
"C:/Stockholm.mdb"
arcpy.Buffer_analysis
"C:/XY.txt"
( "C:/student" )
( "C:/student/Streets.shp" )
( "C:/student/Streets.shp" )
returns "Streets.shp"
returns "C:/Student"
"C:/STUDENT" = "c:/StUdEnT"
arcpy.BUFFER = arcpy.buffer
Introduction to
Python and ArcGIS for
Geoprocessing Scripts
Lecture 10
Example
Get GIS data
Example
Downloaded, processed, and symbolized layers
Setup
Run Python from Windows Command Prompt
Setup
Easier to create a customized shortcut
Setup
Start Command Prompt in same folder as script