McConkey Chapter 1 Notes

Chapter 1 is a fairly easy read that introduces what Python scripting is and some things that be done with the scripting language. There is some programming terminology but you are given most of the definitions for these terms right away. Python is the programming language used by ArcGIS Pro and there are several reasons for this: it is a simple language and relatively easy to learn, it is free and open-source, and it is cross-platform. Being open-source means that the software can be freely shared as well as scripts written by other people making the Python community strong. Being cross-platform means that Python will work on different platforms such as Windows or macOS.

Python programming is commonly known as a scripting language rather than a programming language. Programming involves building components from scratch and is overall more complicated. Scripting takes already made components and manipulates or relates them to other components often producing an output. An example to book using is changing a line shapefile and generating equally spaced points along the line. You can also use Python scripting to automate tasks. An example given in the book is automating copying and pasting a certain type of shapefiles from a geodatabase with other types of shapefiles. This reduces human error and can be more efficient if there are hundreds of shapefiles. Plus, the script can be saved and used again later, saving more time.

McConkey Set-up Procedures and ArcGIS Pro

So the first thing I did was buy Python Scripting for ArcGIS Pro by Paul A. Zandbergen off of Amazon.  It arrived within a couple of days and I was able to start reading chapter one. After reading chapters 1 and 2 I downloaded ArcGIS Pro with the files provided by Dr. Krygier. The download took around 30 minutes to complete. Once downloaded, I made a new folder and transferred the data to the folder. I then extracted all the data, which took several minutes. Afterwards, I went through the data files and clicked on ones that I thought would open the program. I honestly do not remember what the file was called but eventually I got the software downloaded. It is probably a good idea to add ArcGIS Pro to your taskbar at the bottom of the screen. I did this by right-clicking the application on the desktop and finding the option “Pin to taskbar.”

After I downloaded ArcPro I logged into ESI and looked up training modules for Pro. I was able to find a free one that would take around 3 hours to complete. I downloaded the accompanied data and got started. I did not finish the module, partially due to already being familiar with ArcMap. However, the course was very interesting and I saw how more intuitive Pro is compared to its older counterpart. For instance, you can start a project from several premade templates, which will also automatically make a project folder for various related elements such as geodatabases, layouts, maps, and toolboxes.

Another upgrade is that ArcPro is context-sensitive. When you click on layer of different types, the ribbon above may change showing ways to edit the appearance of that layer or specific tools for that layer type. This makes editing the appearance and labeling layers more convenient. It also makes it easier to familiarize yourself on how the different types of layers can be edited. You can still find tools in the toolbox but now you can put tools into a favorites folder for easier access. This is useful for when you plan on performing the same or similar tasks on a project. Learning a new software is difficult but I believe many of the new features of ArcGIS Pro ultimately make the GIS experience more convenient.

Wade: Chapter 3: Geoprocessing in ArcGIS Pro

Mack Wade

Chapter 3: Geoprocessing in ArcGIS Pro

This chapter was pretty easy to follow along to. I had never used modelbuilder before so that was interesting. 

  • Batch Mode: Batch mode is a network round trip-reduction feature that, as its name implies, batches up data-related operations in order to perform them in more coarse-grained chunks.
  • Batch Processing: Computerized batch processing is the running of “jobs that can run without end user interaction, or can be scheduled to run as resources permit.
  • Current Workspace: Current Workspace—The workspace from which inputs are taken and outputs are placed when running tools. 
  • Geoprocessing: Geoprocessing is a framework and set of tools for processing geographic and related data.
  • Iteration: repetition of a mathematical or computational procedure applied to the result of a previous application, typically as a means of obtaining successively closer approximations to the solution of a problem
  • ModelBuilder: ModelBuilder is a visual programming language for building geoprocessingworkflows

Review Questions

  • Describe some of the general elements of the geoprocessing framework in ArcGIS Pro.
    • A collection of tools, methods to find and execute tools, environment settings and other geoprocessing options that control how tools are run, python window, geoprocessing history 
  • What are the three types of tools in ArcGIS Pro
    • Built tools, script tools, model tools, also system tools and custom tools
  • Explain the difference between system tools and custom tools
    • System tools are created by Esri
    • Custom tools are created by a user or third party
  • What are the strengths and limitations of batch processing in Pro
    • Geoprocessing tools can be run in a batch mode that allows you to run the tool multiple times using many input datasets or different parameter settings. This makes it possible to run a tool many times with very little interaction. 
  • What are some of the similarities and differences between models and tools and script tools in Pro
    • Model tools help you execute multiple tools at the same time
    • script tools help you create your own detailed tool by connecting applications

Wade: Chapter 2: Working With Python Editors

Mack Wade

Chapter 2: Working with Python Editors

Notes

This chapter wasn’t too hard to follow along to. I’m pretty familiar with Pro and some of the terms used. I only followed along with the Python window in Pro. 

Key Terms:

  • Command Line Interface: A command-line interface processes commands to a computer program in the form of lines of text.
  • Dependency: to refer when a piece of software relies on another one. Simply put, if Program A requires Program B to be able to run, Program A is dependent on Program B.
  • Environment: a hardware platform and the operating system that is used in it
  • Interactive Interpreter: Python interpreter runs each line of your code directly. This allows you to use the Python interpreter interactively, simply by typing python at a command prompt.
  • Module: A module is a software component or part of a program that contains one or more routines
  • Package Manager: A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer’s operating system in a consistent manner.
  • Printing: refers to writing text on the screen
  • Prompt: signals where you can type code
  • PyCharm: PyCharm is an integrated development environment used in computer programming
  • Python editor: has a menu-driven interface and tools for organizing and testing Python scripts to make working with Python easier
  • Python environment: A virtual environment is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them. 
  • Python Package manager: Python Package Manager is a Python utility intended to simplify the tasks of locating, installing, upgrading and removing Python packages. It can determine if the most recent version of a software package is installed on a system, and can install or upgrade that package from a local or remote host.
  • Python Shell: Python provides a Python Shell, which is used to execute a single Python command and display the result.

 

Review Questions

  • Which Python editor comes installed with every version of Python? 
    • IDLE comes installed with every version of python. 
  • What are some of the recommended Python editors to work with in Pro?
    • Spyder, Pycharm
  • What is syntax highlighting?
    • Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms.
  • What is the file extension for a Python script file?
    • .py 
  • How do you open the Python window in Pro?
    • Analysis Tab > Python > Python window
  • What are some typical examples of autocompletion prompts in the python window, and how do they help you write proper code
    • They assist in reducing the amount of writing you need to do

Wade: Chapter 1: Introducing Python

 

Mack Wade

Chapter 1: Introducing Python

Notes

  • Python is a free + open source software (FOSS)
  • Programming is building elements from scratch
  • Scripting is the glue that allows elements to work together
  • Python is both a scripting and programming language
  • Python is the preferred programming language for ArcGIS Pro (Pro uses Python 3)

Terms

  • Back Porting – When a software patch or update is taken from a recent software version and approved to an older version of the same software
  • Backward Compatibility – a property of a system, product, or technology that allows for interoperability with an older legacy system, or for input designed for such a system
  • Cross Platform – Any software application that works on multiple operating systems
  • Interpreted Language – A programming language which are generally interpreted, without compiling a program into a machine
  • Object Oriented – A methodology which enables a system to be modeled as a set of objects which can be controlled and manipulated in a modular manner
  • Object Oriented Programming (OOP) – A programming paradigm that relies on the concept of classes and objects
  • Syntax – The set of rules that defines the conditions of symbols that are considered to be correctly structured statements or expressions in that language

 

Review Questions

  • What are some of the key features of Python that make it suitable as a scripting language to work with ArcGIS Pro? 
    • Python is the preferred language for Pro, and has its own module, ArcPy,  that allows python to translate GIS functions. You can also run Python on the Python window in Pro that allows you to directly run code and see results in the map. 
  • What does it mean that Python is an interpreted language? 
    • Python is called an interpreted language because it goes through an interpreter, which turns code into the language understood by the computer’s processor
  • What are some of the differences between scripting and programming?
    • Scripting
      • To automate certain tasks in a program
      • Extracting info from a data set
      • Less code intensive as compared to traditional programming languages
    • Programming
      • Typically run inside a parent program 
      • More compatible while integrating code with mathematical models
  • Which Version of Python is used with ArcGIS Pro?
    • Python 3
  • What are some of the reasons to invest time and effort into learning Python?
    • Python is very easy to learn as a beginner. Python can also automate tasks that would otherwise be performed manually and would take up time. 

Frawley: Chapter 4 Notes

Chapter 4 Notes: This was an amazing review for me, essentially a complete introduction to python and its syntax and how to use it. This was genuinely the best python tutorial that I have read just because of how concise and to the point it was. I’ve read about two different intermediate-level python books and they didn’t compare to the examples and just the great layout the author put forth. Anyone could read through this chapter a few times and receive a pretty intermediate-level understanding of python. Genuinely you can mentally program in your head once learning the syntax. For me, this has helped me visualize projects easier and how I would accomplish them. I spent at least two hours reading this chapter several times to absorb the massive amount of information thrown at you. 

It helped me ponder on a semester project. I’m possibly thinking about attempting to automate a mapping sequence and run data extraction by teaching the program how to locate and measure each feature. On what, I am not exactly sure yet. 

 

What are the main data types in python? Which data types are sequences? Which data types are mutable, which are immutable? 

Strings, tuples, lists, dictionaries, boolean expressions, integers, float. Strings, tuples, and numbers are immutable. Lists and dictionaries are mutable, meaning they can be modified. 

 

Describe the difference between true division and floor division. 

Floor division divides with no remainder, while true division divides into a whole number with a leftover remainder. 

 

Explain what the dynamic assignment of a variable means. 

Dynamic assignment of variables occurs after you assign a value to it. Specifically, y = 6 is an integer, y =  10.33 is a float, and y = “Mark” is a string. The variable you assigned the value to becomes that exact data type you applied to it. 

 

Give examples of variable names and why they are good. 

Counter, field5, my_file. Underscores are great for creating a unique variable name. All lowercase or including a number helps differentiate the variables from the rest of the code to avoid confusion. 

 

What’s the difference between an expression and a statement in python, give examples.

An expression is a value with no variable assignment. For example, 3 * 10 and the console will calculate it and return 30. A statement is a function that assigns a value to a variable. For example, x = 40 * 3. The x itself is not a value, it is just assigned one, and to display the result you need to incorporate the print() function to display the value. Print(x) and it would return 120. 

 

Explain the use of quotation marks in python

Quotation marks assign a collection of characters as a string, which is designated to a variable. 

 

What are Unicode strings? 

Strings are essentially plain text, and Unicode allows that plain text to be converted into other languages, and with Unicode you can use different letters from other languages by using their designated ASCII code. 

 

Name five built in functions in python and provide an example of each one’s use. 

Print(x) : Prints a result from a function. Print (name) – Mark

pow(x,y) : First number is multiplied by a ‘power’  of the later value pow(2,3) – 8 

string (x) : Can convert an integer into a string to be able to display the integer in a normal line 

of string characters. str(10) = “10”

abs(x) : Returns absolute value of a number. abs(-8) – 8

float(x) : converts a string or number into a float. float(“8.0”) – 10.0 

 

What is dot notation? 

Shows that method belongs to the object. What comes after the dot belongs to what came before it. 

 

Describe the use of forward and reverse indexing sequences. Provide an example of slicing strings and lists. 

Forward indexing is used to extract or display certain characters in a string, list, dictionary, or tuple, by a specific number correlated to the character. For example, indexing starts at 0, so indexing a string can retrieve a certain number or letter. Mystring = “Mark is the best” 

Mystring[0] would return “M”. Slicing strings and lists can be used to take a chunk of letters or values from the string or list. This is done by using the index numbers and a colon to separate the first and last values you want to return from the string or list. 

 

Name three methods of string objects in python, provide an example of each one’s use. 

.join(x) – Joins values in a list into one string. 

Leela_list = [ ‘she’ , ‘needs’ , ‘dog’ , ‘food’] 

Leelastring = “”

leela_list.join(leelastring) = ‘she needs dog food’ 

 

.split(x) – Can turn a string into a list by splitting each word into substrings

bestdog = “Leela is the best dog.”

Bestdog.split(“ ”)  = [‘Leela’ , ‘is’ , ‘the’ , ‘best’, ‘dog’] 

 

.replace(x) – replace all occurrences of a specific substring with another substring

 

myhouse = “609 logan”

myhouse.replace(“609”, “Toronto”)

 

What are some key similarities between lists and tuples? 

They can both hold multiple values, except tuples are immutable. 

 

Describe the use of boolean values to evaluate a condition. 

Boolean values are true/false values that can differentiate if a value is there or not, essentially a yes or no. 

X = 3 

X == 8

Returns false 

Describe the key steps to create a dictionary and add new items to the dictionary. 

The first step to creating a dictionary is to assign a variable name to it and set it equal to empty braces. For example,

 teams = {}

To add to a dictionary, you include brackets to the variable with a pair of quotation marks inside and set it equal to the complete string. 

teams[“CHI”] = “Chicago Blackhawks” 

And to add to the dictionary you continue to use the same syntax. 

 

Why should backslashes be avoided when writing paths in python? 

Because a single backslash is used to denote a new line of text in strings. 

 

Describe how branching is implemented in python. 

Branching is implemented with if statements, telling the compiler that it should take one path or another depending on the returned value. 

 

What is a compound statement in python? 

A compound statement is a block of code expected to run together as a block, which is denoted by indentation. 

 

What are the two main looping structures in python? Describe each. 

While loops check for the value of a variable and require an exit statement. 

For loops repeat a block of code for each element in that sequence 

 

What approaches can be used to split long lines of code into multiple lines and improve readability? 

Enter a backslash in a defined string within quotation marks. 

Implied line continuation (), [], {}. 

Hanging indentation 

 

Why should you add comments to your scripts? 

To help separate parts of the code into blocks

Designate certain code with comments to know that this block is performing a particular function within the script.

 

Frawley: Chapter 3 Notes

Chapter 3 Notes:

Types of tools, batch processing. Model tools vs script tools, how to automate workflows. Dynamic naming for batch processing %Name%. Took me about 40 minutes to read thoroughly. 

Chapter review questions: 

 

Describe some of the general elements of the geoprocessing framework in ArcGIS Pro? 

Collection of tools organized into toolboxes, python window for executing python, geoprocessing history, Model Builder.

 

What are the three types of tools in ArcGIS Pro? 

Geoprocessing, analysis tools, geocoding, cartography. 

 

Explain the difference between system tools and custom tools. 

System tools are premade executable tools that you can drag and drop your files into to complete a task/output. Custom tools are obtained by the user through their own creation or collection of third-party tools. 

 

Provide examples of commonly used environments and how they impact running geoprocessing tools. 

Environments are where the workspace is located essentially, and environments can be modified to use specific values for the output of the geoprocessing tools. 

 

What are the strengths and limitations of batch processing in ArcGIS Pro? 

Batch processing uses the same tool multiple times using different parameters. Different iterations use different parameters to finish their processing. For tools with multiple input parameters, you can only choose one to use as a batch parameter. 

 

Explain the use of dynamic naming in batch processing. 

Creates a different output for each individual parameter. %Name% uses the input variable name and combines it with the remaining part of the naming scheme. %Name%_final will turn all inputs into separate outputs with their respective names. 

 

What are some of the differences and similarities between model tools and script tools in ArcGIS Pro? 

Model tools help you execute multiple tools at the same time, while script tools help you create your own detailed tool by connecting applications, better programming logic, and can be run by themselves on a stand-alone script reader. 

 

Why would you automate a specific workflow instead of a model? 

It’s more reliable to automate one workflow and observe it, rather than automating a model and trying to decipher the results after all functions are completed running. 

 

What are ways to run python code in the context of automating workflows in ArcGIS Pro? 

Scheduling python scripts to run at an exact time, by using the task scheduler.

 

Frawley: Chapter 2 Notes

Chapter 2 Notes:

The autocomplete feature allows you to not need to memorize all function/statement diction and their uses.  Explains different IDEs and their uses. How to use the python window in Arc. Explains which tools are used with the help of python for specific geoprocessing tasks. 

Quick and easy to read. Probably only took around 25 minutes. The chapter review questions are the following: 

 

What does IDE stand for? 

Integrated Development Environment.

 

What does it mean that python is an interpreted language? 

Interpreted language means that it doesn’t need to compile into binary before the script runs. 

 

Which python editor comes installed with every version of python? 

Command prompt, or IDLE (Integrated DeveLopment Environment)

 

What are some of the recommended python editors to work with ArcGIS Pro 

PyCharm, Spyder, Visual Studio

 

What are some of the differences and similarities between python editors? 

Essentially they’re similar in every aspect except Spyder is more well supported with geospatial programming and visualization. 

 

What are the general steps to install and configure each of the python editors? 

Download the python language from their website, decide which IDE you want to work with and go to their website and download the version for your operating system. Once you download the IDE of choice, follow the setup instructions and begin writing your code. I also recommend giving a designated folder to keep each python project organized and by itself. 

 

What is the default environment when working with python and ArcGIS Pro 

IDLE 

 

What is syntax highlighting? 

Syntax highlighting assigns different colors to statements, functions, text, etc. 

 

What is a file extension for a python script file? 

.py 

 

How do you open the Python window in ArcGIS Pro? 

Click the toolbox at the top of ArcGIS Pro and click open the python window. 

 

What are the two sections of the python window, and what purpose does each one serve? 

The top is the transcript, and the bottom window is called the prompt. The transcript is blank until you start scripting in the prompt window. When you run the code in the prompt, it displays the script on the above transcript window. 

 

What are some typical examples of autocompletion prompts in the python window, and how do they assist in writing proper code? 

They reduce the amount of code you need to memorize since the list of autocomplete prompts provides the name of different functions and descriptions on how to use them. This results in fewer syntax errors and is faster than typing the full name of the function. 

 

Which features of the python window illustrate that it is fully integrated with the geoprocessing framework of ArcGIS Pro? 

Most of the geoprocessing framework and data extraction/management tools in ArcGIS Pro are written in Python 3, so you are able to manipulate default python tools within the software using the Python window. Within the python geoprocessing tools, you can manipulate the script to incorporate multiple layers or rasters at once, instead of individually. 

 

Frawley: Chapter 1 Notes

Chapter 1 Notes:

Python is an interpreted language that is easy to understand and has a simple syntax. Python 3 is the latest version of python that is used with ArcGIS Pro. 

This chapter was a relatively easy read and clear to understand. This chapter just provided the basics of what Python is and shows some example scripts that you will eventually understand. This chapter took me about 20 minutes to read, so I’m not entirely sure about the questions included because I read all of the chapters before completing each review question set. I completed the end of chapter questions and they are as follows:

 

What are some of the key features of Python that make it suitable as a scripting language to work with ArcGIS Pro? 

Python is easy to learn, free and open-source, multi-OS platform use, and it is object-oriented, meaning that it can interact with multiple interacting objects within the script. 

 

What does it mean that python is an interpreted language? 

Interpreted language means that its code doesn’t need to be compiled into binary when you run it. 

 

What are some of the differences between scripting and programming? 

Scripting essentially takes components that are already made and combines them together to create something, while programming is more about creating something from the ground up on your own with unique code. 

 

Which version of python is used with ArcGIS pro? 

Python 3 is the version used with ArcGIS Pro. Python 3 was introduced as the newest version of the language in 2008. 

 

What are some of the reasons to invest time and effort into learning python? 

 Python can automate workflows and tasks to reduce the amount of time and effort into collecting and sorting data. Python is one of the most commonly used programming languages within the geospatial community.