Posts

Showing posts from May, 2021

The Art Of Debugging In ArcPy

Image
 Debugging Time... Today I wanted to share a post about debugging code and error handling. I am going to talk about why debugging is such an important topic in software development. The n we are going to take e a look at handling errors to make incorrect code work. Below are three examples from ArcPy Python scripts in which we look at both debugging errors and handline errors to pass the code for GIS data located inside of an Arc Pro project file.  This is specifically for ArcPy which is the Python framework for Arc GIS Syntax Debugging (Spelling can make or break your code, as well as spaces) Mod2_Script1_Template.py contains two errors and/or exceptions in it. Fix these errors so that the script runs. The successful script should print out the names of all fields on the Module2/Data/parks.shp attribute table. In order to run this script, I needed to open Arc GIS Pro and verify that the data is in my Arc Pro project. When opening arc GIS Pro, I could see the following data......

Introduction to Python Programming in GIS

Image
Hello Python Programmers!  I am very excited to share today my first python script in my Graduate GIS Program.  Today we are going to be talking about the fundamentals of Python scripting and developing a basic dice game, as well as the ability to sort through random numbers in a list and remove a number from said list.  Before We Begin... I want to talk about some things in order to explain the fundamentals of Python coding.  Look up these concepts below as they are crucial to understanding GIS Python development! Methods Functions Python Syntax Data Types such as arrays, Dictionaries, lists, Tuples, etc... Loops  Boolean Logic Debugging Git and Github Version Control Importing Modules such as Random or Arcpy Here are some great documentation links below as well for learning syntax, debugging, and structuring of Python and the python API for Arc GIS Pro.  https://docs.python.org/3/ https://pro.arcgis.com/en/pro-app/latest/arcpy/main/arcgis-pro-arcpy-refere...