Converting Vector Data

Quite often data isn’t in a format that makes it readily available for both mapping software and people to read. Many data formats store the geographic data in a binary format. This format is normally readable only by computers and is designed for software to use. Some spatial data formats are in a simple text format, which is easier to explore.

Geography Markup Language (GML)

One example of a text-based format is Geography Markup Language (GML). It uses a text syntax to encode coordinates into a text file. GML can then be read or manually edited without needing a special piece of software or at least nothing more than a common text editor. Creating GML from scratch isn’t very pleasant. Fortunately, another OGR utility exists that can convert OGR-supported data formats into and out of other formats, including GML.

GML has three different versions: GML1, GML2, and GML3. There are many sub-versions as well. The differences between versions can be a problem because certain features may not be directly transferable to another. The tools introduced in this chapter use ogr2ogr, which outputs to GML2 format.

GML was designed to be suitable for data interoperability, allowing the exchange of spatial data using a common format. This has opened up the possibilities for various web services that operate using different software yet can communicate using this standard format. See Chapter 12 to learn more about this example.

GML’s downside is its size. Text files can’t hold ...

Get Web Mapping Illustrated now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.