This section contains scripts, videos, and documentation to get started with Python and ArcGIS. The ArcPy_Bytes.zip file contains Python scripts (both 2.x and 3.x) and Jupyter notebook files (.ipynb) that can be used with the videos. The Jupyter notebook files contain some explanation that can be used to study as well as directly run Python scripts (which also have in-line comments).
The Python script files (.py) do not require Jupyter notebooks; the Jupyter notebook files (.ipynb) do. The Python scripts can be opened and run with the IDE of their choice (assuming and data path changes have been made the script, if needed). See above for the suggested IDEs.
NOTE: For either the Python script files (.py) or the Jupyter notebook files (.ipynb), the user will likely need to change the path location to any data files needed. Some of these fundamental Python scripts don’t require data and can be directly run. Users don’t have to use Jupyter; they can open and study the Python scripts directly. In-line comments are provided in all of the scripts.
Getting Started Scripts: ArcPy_Bytes.zip
Python Script Structure
Short video reviewing the basic Python script structure.
Video reviewing creating and using variables.
Working with Numbers
Video review some “really basic” use of numbers and simple calculations. There are many other modules that can perform complex math. Some of these are already installed when Python is installed with Pro. Some users may need to install other Python modules for math and other options not currently installed when Pro is installed. NOTE: Any additional modules will need to be re-installed when Pro is upgraded.
Working with Strings
Video covering some basic uses of strings (aka character strings, text strings). Other videos will cover this topic when reviewing the select layer by attribute tools and cursors.
Workspaces and Data Paths
This video is a bit of an extension of strings. Mostly focuses on workspaces which is probably a good choice to use for “input” type data locations.
Lists and Loops
This video covers a small portion of Python lists, then shows a couple examples of using arcpy for GIS based list routines (e.g. ListFeatureClasses, ListFields, etc). Also, one a list is accessed, a for loop is often used to process values in a list. The “while” loop is also described.
This video reviews the use of the conditional if..elif..else structure. Conditional statements can be used for decision making and flow of control through a script.