Geoscience Reference
In-Depth Information
Chapter 2
Vector Data Processing
This chapter will focus on geospatial vector data and presents examples of data
processing using the OGR Simple Features Library that is part of the GDAL library.
We provide clear examples of how the OGR interface can be used to retrieve metadata
and summary information from vector data sets, but more importantly we demon-
strate how OGR is used to effectively process geospatial vector data. It is clear that
there are multiple formats available for vectorial spatial data, each with their advan-
tages and disadvantages and it is beyond the scope of this topic to address each and
everyone. For this reason we have decided to focus on some of the more common
formats that are in use today. These include the ESRI Shapefile as it is probably
the more ubiquitous format around; we also use the OpenStreetMap PBF format,
Keyhole Markup Language (KML) files used within Google Earth and the Spatialite
database format. Although we only focus on a number of key formats, it is important
to bear in mind that you can adapt the examples to use other formats by substituting
the format abbreviation within the OGR code (provided your GDAL installation is
properly configured).
Initially this chapter will present a brief outline of the vector data model and
continue by introducing the OGR library. We then delve into the individual OGR
utilities and present examples for each showing its capabilities in terms of format
and projection translation to spatial and attribute queries. The examples start off by
being quite simple but gradually increase in complexity to achieve more complex
processing capabilities. We anticipate that the code snippets can easily be adapted to
your spatial data, formats and projection, etc.
2.1 Vector Data Model
The vector data model represents space as discrete entities (objects) that are defined
by coordinates on a two dimensional plane and are described by their attributes.
The three basic types of vector objects include points, lines and polygons, which are
presented in Fig. 2.1 .
 
Search WWH ::




Custom Search