Chapter 3. Reading and writing vector data

 

This chapter covers

  • Understanding vector data
  • Introducing OGR
  • Reading vector data
  • Creating new vector datasets
  • Updating existing datasets

They seem to be rare these days, but you’ve probably seen a paper roadmap designed to be folded up and kept in your car. Unlike the more recent web maps that we’re used to using, these maps don’t use aerial imagery. Instead, features on the maps are all drawn as geometric objects—namely, points, lines, and polygons. These types of data, where the geographic features are all distinct objects, are called vector datasets.

Unless you only plan to look at maps that someone else has made, you’ll need to know how to read and write these types of data. If you want to work with existing data in any way, whether you’re summarizing, editing, deriving new data, or performing sophisticated spatial analyses, you need to read it in from a file first. You also need to write any new or modified data back out to a disk. For example, if you had a nationwide city dataset but needed to analyze only data from cities with 100,000 people or more, you could extract those cities out of your original dataset and run your analysis on them while ignoring the smaller towns. Optionally, you could also save the smaller dataset to a new file for later use.

In this chapter you’ll learn basic ideas behind vector data and how to use the OGR library to read, write, and edit these types of datasets.

3.1. Introduction to vector data

3.2. Introduction to OGR

3.3. Reading vector data

3.4. Getting metadata about the data

3.5. Writing vector data

3.6. Updating existing data

3.7. Summary

sitemap