McConkey: Chapter 5

This chapter was alright compared to the others but there are definitely a few concepts I do not quite understand yet.

ArcPy is built into ArcGIS Pro if you are using IDLE. Other IDE’s like Spyder requires extra steps to access ArcPY. 

Key Terms:

Class- are used to create objects which have properties and methods

Environment- Hidden parameters that influence how a tool is run

Hard-coded- the parameters are not set as variables but use the values assigned to them directly. 

Namespace- a system to make sure all the names are unique and can be used without any conflicts

nontool function- A function in Python performs a specific task. ArcPy provides several functions that are not tools, otherwise known as nontool functions. Nearly all  geoprocessing tools in ArcGIS Pro or functions in ArcPy, but not all ArcPy functions are geoprocessing tools in ArcGIS Pro.

Package- a collection of modules, functions, and classes that adds functionality to Python

Property- a workspace is an example of a property that an object has

toolbox alias- tools may share the same tool name so they require a specific tool alias when applied in ArcPy (ex. Clip_management)

tool label- a tool name with no spaces (ex. AddField [as in ArcPy])

tool name- a tool label that contains spaces (ex. Add Field [in Data Management toolbox])

factory code (of a coordinate system)/well-known ID (WKID)- A series of numbers used to represent a name. WKIDs are often used for map projections because their names can be written out in different ways but not always be recognized by Python.

Workspace- provides a default location for the files you will be working with, such as inputs and outputs of geoprocessing tools.

 

Review Questions:

Explain the relationship between the geoprocessing tools in ArcGIS Pro and the functions in ArcPy?

ArcPy must be imported first in order to use its geoprocessing tools. ArcPy makes Python scripting easier and more powerful. 

What exactly is the difference between required and optional parameters of geoprocessing tools, and how does this impact writing code to use these tools in a script?

Required and optional parameters are just as they sound. Required parameters are required for the script to run properly while optional parameters are not. There are a variety of ways to write the optional parameters in your script without them actually doing anything. This can be done by writing “”, “#”, or None in its place. This will leave the optional parameters at their default values.

Give an example of the use of variables for parameters instead of hard-coding values to make your code more versatile?

You could write as follows:

import arcpy

arcpy.env.workspace = “C:/Data”

infc = “streams.shp”

clipfc = “study.shp”

outfc = “results.sph”

arcpy.Clip_analysis(infc, clipfc, outfc)

If you are writing scripts or tools to be shared with others it is wise to use variables instead of hard-coding. Variables also make it easier to reuse part of your code.

Explain some of the uses of the “Result” object: 

ArcPy returns the output of a tool as a Result object. The result object can consist of a string, number, or a Boolean value. (See page 163)

Why are classes used as input parameters for geoprocessing tools?

ArcPy classes are often used as shortcuts for tool parameters that would otherwise have a more complicated equivalent. They are often used to avoid using lengthy strings.

Explain how ArcGIS Pro is licensed and how this impacts handling licensing when writing scripts.

Licensing effects which geoprocessing tools can be used by the user.

 

 

McConkey: Chapter 2

This chapter is not too vigorous, but I will definitely have to refer back to it if I want to download Spyder or PyCharm down the line.

Chapter 2 focuses on the various Python editors and what makes each one unique. A Python editor, otherwise known as integrated development environments (IDEs) is used to write, test, and fix code. Python comes with a built-in editor known as IDLE, but Spyder and PyCharm are also recommended IDEs that must be installed separately. This chapter explains how to open and make a shortcut for IDLE as well as directions for installing Spyder and PyCharm, which require some extra steps. The editors may look different but the code works for all of them in the same way. In other words, you do not need to change how you write your code when using another editor. Both Spyder and Python are free and are cross-platform, so they will work on different computer systems. In summary, Spyder is easier to use, but PyCharm has more features within the user interface. (PyCharm also has an optional dark theme.)

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.