ArcPy Final Assignment

Mack Wade

 

Get Started with Python in ArcGIS Pro

In this course I learned how to write code to determine the number of features for all the feature classes in a workspace. This course also introduced some of the basics of Python syntax as I wrote code into the Python window in ArcGIS Pro.Ā Ā 

In order to begin this project I had to download data from ESRIā€™s website. I really enjoyed this course and chose to do it because of the downloadable data that I could use as I followed along, unlike the book which did not provide downloadable datasets for itā€™s walkthroughs.Ā 

The course provided a few shapefiles to work out of, but for this exercise I used the Ambulances.shp.Ā 

First, I ran a tool using Python. In Arc there are many ways and routes to complete one task. This task was to find the count of the items in the shapefile. You can do this in the attribute table or by using the Get Count tool in the Toolbox. You can also find the count by running a script in the Python window.Ā 

To do this you take go to the toolbox history > right click the Get Count tool > Send to Python Window. After sending the window, I manually entered ā€œAmbulancesā€ since thatā€™s the shapefile I want to be working out of. The script looked like this:

arcpy.management.GetCount(“ambulances”)

After completing this task, I learned that when completing a script in the Python window, the history is updated to include the task.Ā 

The next task that I practiced was inputing an assignment statement.Ā 

y = 73Ā 

Then,Ā 

x = 37

Then,

x * yĀ 

Then, after pressing enter, the Python window answered with 2701

Next, I did a similar thing but with Temperature.Ā 

temp_c = 17

temp_f = temp_c * 9 / 5 + 32

print(temp_f)

The Python window responded with 62.6

The next assignment was learning how to use the Python window as a tool to help you when writing code. You can do this by hovering over the prompt and reading the information that the window provides.Ā 

There is also a system of code completion. For example, if you want the ā€œGet Countā€ tool, you can typer ā€œGetā€ in the Python Window and suggestions will pop up to help you finish the prompt easier.Ā 

I really enjoyed this tutorial. I thought that it was very easy to follow and was helpful. I see myself using more of ESRIā€™s resources in the future if or when needed when writing scripts. I think that if any student was interested in this course in the future these tutorials would be a better resource than the book we used.

I had some screen shots from this assignment but they did not get added into the blog format. If you would like me to send those over to you. let me know.