Lesson 3 overview

An essential part of a GIS, is that data can represent both the geometry (locations) of geographic features, and the attributes of those features. This combination of features and attributes is what makes GIS go beyond just "mapping". 

Much of your work as a GIS Analyst may  involve adding, modifying, and deleting features and their attribute data from the GIS. To do this, you need to know how to query and select the data that is most important to your projects. Sometimes you'll want to query a dataset to filter features that match a certain criteria (for example, single-family homes constructed before 1980) and calculate some statistics based on only the selected records (for example, percentage of those homes that experienced termite infestation).

ArcGIS Pro contains several data selection methods that an analyst can use to Create, Read, Update, and or Delete (CRUD) feature data. This can become tedious and error prone if performed manually, and arcpy provides many of these methods to be performed programmatically.  Performing these programmatically through scripting is often a faster and more accurate way to read and write large amounts of data.

Using a script to work with your data introduces some other subtle advantages over manual data entry. For example, in a script, you can add checks to ensure that the data entered conforms to a certain format. You can also chain together multiple steps of selection logic that would be time-consuming to perform in ArcGIS Pro.

This lesson explains ways to read and write GIS data using Python. We'll start off by looking at how you can create and open datasets within a script. Then, we'll practice reading and writing data using both geoprocessing tools and cursor objects. We mentioned in the previous lesson that arcpy contains special data-access objects, called cursors, that you can use to perform CRUD operations. You'll quickly see how the looping logic that you learned in Lesson 2 becomes useful when you are cycling through table data using cursors. Although this is most applicable to vector datasets, we'll also look at some ways you can manipulate rasters with Python. Once you're familiar with these concepts, Project 3 will give you a chance to practice what you've learned.