Chapter 6. Manipulating geometries with OGR

 

This chapter covers

  • Creating points, lines, and polygons from scratch
  • Editing existing geometries

Thus far we’ve talked about using OGR to read and write vector datasets and how to edit attribute values, but you haven’t manipulated the geometries in any way. If you want to create your own data and not use someone else’s, you’ll need to know how to work with the actual geometries. For example, if you have a time series of GPS coordinates from a hiking or bicycling trip, you can create a line that represents the route you took. You can even compare the timestamps from the GPS locations to the timestamps on the photos you took to create a point dataset showing where you stopped to take pictures.

You might even need to know how to manipulate geometries to better display existing data. For example, say you want to create a map using your photo points and link them to the actual photos. Certain locations will probably have multiple photos in the same spot. You can deal with this many ways, but one way is to offset each point a little in a different direction so that it looks like a cluster of points instead of only one. But to do this, you need to know how to manipulate the point geometries themselves.

6.1. Introduction to geometries

6.2. Working with points

6.3. Working with lines

6.4. Working with polygons

6.5. Summary

sitemap