Python: An Introduction Brittney White Questions we’ll address

• What is Python? • Why use Python with ArcGIS? • What is ArcPy? - Demo: ArcGIS Pro Python Reference • Where do I write Python code? - Demo: Python window • How do I perform batch processing? • How do I use data properties to control the flow of a script? • How do I run a geoprocessing tool? - Demo: Prepare shapefiles for analysis • Bonus: 5 tips & tricks for getting started with Python What is Python?

• Simple and easy to learn • Free and open source • Cross platform • Scripting language of ArcGIS Why use Python with ArcGIS?

• Automate repetitive tasks - Data management - Spatial analysis - Map automation • Make your own geoprocessing tools What is ArcPy?

• Access point to ArcGIS desktop functionality through Python

1. Geoprocessing tools 2. Functions like ListFeatureClasses, Describe 3. Classes like Polygon, SpatialReference 4. Modules like arcpy.da, arcpy.mp Demo: ArcGIS Pro Python Reference Where do I write Python code?

• IDE - PyCharm, , Wing IDE, Python IDLE,…

• Python window in ArcGIS Demo: Python window How do I perform batch processing? How do I perform batch processing? List feature classes example

• arcpy.ListFeatureClasses ({wild_card}, {feature_type}, {feature_dataset}) - Returns a list of feature classes in the workspace How do I access data properties?

• arcpy.Describe() - Returns a describe object - Describe object has dynamic properties How do I access data properties? …to control the flow the script?

if arcpy.Describe().property == something: #Do something else: #Do something else How do I run a geoprocessing tool?

• Tool syntax - arcpy.toolname_toolboxalias(parameters) - arcpy.toolboxalias.toolname(parameters)

• Where do I find the syntax? - Tool help page - help(arcpy.buffer_analysis) - Copy Python command - Send to Python window Goal ArcPy List the shapefiles List function - in a folder arcpy.ListFeatureClasses() Demo: Prepare Check the Describe function - arcpy.Describe() coordinate system of each shapefile shapefiles for Project the Geoprocessing tool - shapefiles into the arcpy.Project_management() - analysis local coordinate system Move shapefiles Geoprocessing tool - into a file arcpy.CopyFeatures_management() geodatabase 5 tips & tricks for getting started with Python 5. Use the print function print function 4. Copy and paste Copy and paste - Code samples Copy and paste - Paths

Shift + Right-click a file reveals the Copy as path option 3. Participate in the GeoNet Python community

2. Take Esri Training about Python https://www.esri.com/training/catalog/

1. Manage Python packages with ArcGIS Pro

Additional Python Sessions

• Python: Beyond the (145 B) - Tuesday 3:00 pm - Wednesday 2:45 pm • Python: Building Geoprocessing Tools (145 B) - Wednesday 4:00 pm • ArcGIS API for Python: Scripting Your Web GIS (145 B) - Wednesday 8:15 am Print Your Certificate of Attendance Print stations located in the 140 Concourse

Tuesday Wednesday 12:30 pm – 6:30 pm 10:30 am – 5:15 pm GIS Solutions Expo GIS Solutions Expo Hall B Hall B

5:00 pm – 6:30 pm 6:30 pm – 9:00 pm GIS Solutions Expo Social Networking Reception Hall B Smithsonian National Portrait Gallery Please Take Our Survey in the Esri Events App

Download the Esri Events Select the session Scroll down to find the Complete answers app and find your event you attended feedback section and select “Submit”