You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This guide was created by the staff of the GIS/Data Center at Rice University and is to be used for individual educational purposes only.

The steps outlined in this guide require access to ArcGIS Pro software and data that is available both online and at Fondren Library.

The following text styles are used throughout the guide:

Explanatory text appears in a regular font.

  1. Instruction text is numbered.
  2. Required actions are underlined.
  3. Objects of the actions are in bold.

Folder and file names are in italics.

Names of Programs, Windows, Panes, Views, or Buttons are Capitalized.

'Names of windows or entry fields are in single quotation marks.'

"Text to be typed appears in double quotation marks."

The following step-by-step instructions and screenshots are based on the Windows 10 operating system with the Windows Classic desktop theme and ArcGIS Pro 3.0.0 software. If your personal system configuration varies, you may experience minor differences from the instructions and screenshots. Some of the features covered in this tutorial may not be available if using an older version of ArcGIS Pro.

Python Crash Course

What is Python?

Python is a high-level scripting programming language often used for data analysis, among numerous other applications. In ArcGIS Pro, Python is used to define many of the tools in the background, and can also be utilized by the user to automate part or all of a data analysis project in ArcGIS Pro.  This automation is done by writing Python scripts, which are instructions written by the programmer for Python to carry out. 

Setting Up a Python Script in ArcGIS Pro

The easiest (and most convenient) way to write Python scripts in ArcGIS Pro is to use notebooks in ArcGIS Pro. We will first set up a notebook in ArcGIS Pro to go over some Python basics, and learn more about notebooks later on. 


(setup notebook)

Python Data Types

The building blocks of a program are variables, which store data in a variety of forms. This data can be made available to the programmer and used later in the program in multiple ways.

Numbers

First, let's work with numbers in Python. By typing the code shown below, we can store the number 3 in variable a, and the number 4 in variable b.


We can check the values of these variables by using the print function as shown below.


Click the "Run" button to run the code in the current cell as indicated below.


After running this cell, we can see the values 3 and 4 appear just below the cell that has been run. 


Now, we can run some basic arithmetic operations with these numbers. The operations shown below correspond to addition, subtraction, multiplication, and division, respectively. After printing each of the corresponding variables, we can see the results. 


(add floats next)

Booleans

Strings

Lists

Dictionaries

Functions

Conditional Statements

Loops

Using Python in ArcGIS


Field Calculations

Fields in ArcGIS Pro

Why Use Python?

Switching Data Types

Defining a Field from Other Fields

Notebooks

Jupyter Notebooks

Jupyter Notebooks in ArcGIS Pro

Automating Workflow Using Jupyter Notebooks

(go through extended example)






  • No labels