Editing shapefiles
Shapefiles are one of the most common data formats in GIS, both for exchanging data as well as performing GIS analysis. In this section, we’ll learn how to work with these files extensively. In Chapter 2, Learning about Geospatial Data, we discussed shapefiles as a format that can have many different file types associated with it. For editing shapefiles, and most other operations, we are only concerned with two file types:
- The
.
shp
file - The
.
dbf
file
The .shp
file contains the geometry while the .dbf
file contains the attributes of the corresponding geometry. For each geometry record in a shapefile, there is one .dbf
record. The records aren’t numbered or identified in any way. This means that, when adding and deleting information from a shapefile, you must be careful to remove or add a record to each file type to match.
As we discussed in Chapter 4, Geospatial Python Toolbox, there are two libraries we can use to edit shapefiles...