applet-magic.com
Thayer Watkins
Silicon Valley
& Tornado Alley
USA

GML
Geography
Markup Language

Background

Geographers like everyone else made wide use of HTML when the Web became available, but HTML was not ideally suited to the needs of geography with its heavy graphics orientation. When XML was released it made possible the easy creation of specialized markup languages. Some geographically-oriented languages were created by none appeared acceptable as a standard for the field. The OpenGIS Consortium (OGC) proposed to put together a standard to be called Geography Markup Language, GML. This language was to be consistent with a model of geographic information, called the OpenGIS Abstract Specification, which OGC had created. GML development was started in 1999 under the auspices of the OpenGIS Consortium and its specification was released in February of 2001. The purpose of this page is to explain GML version 1.0 as given in OGC Document Number 00-029 (May 12, 2000). Although the GML specification calls it version 1.0 there are essentially three forms of GML now:

Although these profiles are characterized and named in terms of the types of users of GML they are, in effect, different systems likely to appeal to different categories of users. This Webpage is concerned with the simplest form of GML, the Profile 1 of the above list.

GML is likely to change as it has already changed, but the future changes are likely to be modification and elaborations of a fundamental model.

General Strategy of GML

GML was to be a content-oriented XML application completely separate from the area of how to display maps and other types of geographic information on the Web. OGC intended to create an unambiguous system of coding geographic information that would make possible the storage and the sharing of such information. This meant the coded documents would not require an expert or special additional knowledge for their interpretation. It is commonplace for some maps or data to unusable except by their caretaker because only the caretaker knows those crucial bits of information such as what the projection is for a map or the base point for the coordinates. GML intended to avoid the problem of missing information for geographic documents. It does this as an application of XML by specifying what information is mandatory for a file and by requiring all documents to be validated by a parsing program.

Formal Structure of Map Documents

The general scheme of GML is that a geographic document involves the specification of a set of features. These features are described by properties, which may be of two types: Simple Properties and Geometric Properties. Simple properties are those that may be given by basic data forms: strings of characters (names), integers, real numbers or true/false (boolean) values. The nature of the features and their properties is the essence of GML. The geometric properties come at the last stage of the specification of a feature but it is expedient to present the geometric properties first. Generally it is feasible to explain a topic as GML has become by breaking it down into modules and simplifying in the interest of clarity. It is not possible to explain GML in its full complexity all at once.

Geometry

The geometric property element of GML is created using Points, LineStrings, and Polygons with the special case of closed linearRings which are merely closed LineStrings. Polygons are more than just LinearRings because there may be an interior boundary as well as an exterior boundary. In addition to these primitive geometric entities GML makes provision for sets (collections) of these elements: i.e., MultiPoint, MultiLineString and MultiPolygon. These are made up, as the names imply, of Points, LineStrings and Polygons. GML has another geometric element that can include geometric elements of any type. This is called a GeometryCollectio. A GeometryCollection can also include other GeometryCollections.

The geometric elements in GML may be specified by a Coordinate List, which is just a list of (x,y) coordinate pairs with some separators such as commas and spaces. The separators can be specified by attribute values of the the <coordinates> tag.

There is another geometric element, the Box, which is specified by two coordinate points, the upper left corner and the lower right corner. The Box element is used more to encode properties component of a geographic document than the strictly geometric structure of a map.

In the above diagram some elements are not fully described in order to improve comprehensibilty. Also in GML the official names of the features denoted Exterior Boundary and Interior Boundary are outerBoundaryIs and InnerBoundaryIs. The obstruse terminology comes from Logic Programming, upon which GML is modeled. Collections of geometric features such as MultiPoint use a subfeature selection element which in the case of MultiPoint is called pointMember. A few examples will illustrate how the geometric information is encoded.

Examples of Geometric Property Encloding in GML
Simple Geometric Features

First consider some simple geometric features. Suppose there is point at x,y coordinates (10,25), a line from (0,0) to (15,30) to (40,70) and a triangle polygon with corners at (30,40), (70,80) and (50,120). These features would be encoded at follows:


<Point>
<coordinates>
10,25
</coordinates>
</Point>


<LineString>
<coordinates>
0,0 15,30
</coordinates>
</LineString>


<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
30,40 70,80 50,120
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>

Collections of Geometric Features
Suppose there were the locations of three cities that were to be grouped together, say (10,25), (15,40) and (20,45). This set of three points could be encoded as:

<MultiPoint>
<pointMember>
<Point>
<coordinates>
10,25
</coordinates>
</Point>
</pointMember>
<pointMember>
<Point>
<coordinates>
15,40
</coordinates>
</Point>
</pointMember>
<pointMember>
<Point>
<coordinates>
20,45
</coordinates>
</Point>
</pointMember>
<//MultiPoint>

The coding for a MutiLineString and MultiPolygon would be similar. A GeometryCollection would require additional tags for <geometryMember> </geometryMember>.

In the above examples each tag was put on a separate line for clarity but there is no necessity of doing this. Each encloding could have been put on a single line and it would still be valid, as would any formatting between these two extremes.

Properties of Map Features

The logical structure of a Feature element is: As in the case of the geometry of a map document, there are the primitive elements and then elements that contain a set of elements. Thus there is the Feature element described about and a FeatureCollection element that contains a set of Features or even other FeatureCollection elements. An interesting difference between a FeatureCollection element and a Feature element is that the boundedBy element (specified by a Box element) is optional for a Feature element it is mandatory for a FeatureCollection element.

While the above diagram serves its purpose of showing the general structure of the featureCollection element of GML it is deficient in that it does that show which elements are optional and which may appear multiple times. The notation that is used to show such information is as follows:

NotationMeaning
ELEMENT*ELEMENT may occur zero
or any number of times
ELEMENT?ELEMENT may occur zero or one time
ELEMENT+ELEMENT may occur one or more times,
it must occur at least once
ELEMENTELEMENT must occur exactly once

The diagram for the featureCollection element with the information on the allowed occurence of the elements is shown below:

As the above diagram indicates the boundedBy element is mandatory for a featureCollection element but optional for a Feature element.

The corresponding diagram for the geometry elements is shown below.

Note the interesting item in the above diagram that the exterior boundary of a Polygon is optional but there can be only one. There may be zero or any number of interior boundaries. Making the exterior boundary optional allows the entire world of the map to defined as a Polygon element.

In order to simply the structure the geometricProperty element in the above diagram is not expanded. A geometricProperty element will include a typeName attribute which may be any of the following: pointProperty, lineStringProperty, polygonProperty and multiGeometryProperty. These in term may have subproperties such as location, centerOf, position, centerLineOf, edgeOf, extentOf, coverage. These subProperties may have subelements which are the geometry classes of point, lineString, polygon, multiPoint, multiLineString and multiPolygon. This is shown diagramatically below:

Since there is no space in the above diagram for the structure of the elements such as centerOf these are given below:

The outerBoundaryOf and innerBoundaryOf elements of course have lineString subelements which in turn have coordinates elements.

With the previous overview of the formal structure of GML it is possible to encode various features of a map.

Examples of Feature Encloding in GML

<Feature typeName="Region">
<name>
Silicon Valley </name>
<description>
The region of the San Francisco Bay Area noted for its high technology industry. It is largely a part of Santa Clara County, California but it also includes portions of San Mateo County.
</description>
<boundedBy>
<Box>
<coordinates>
-123.5,38.7 -121.7,37.1
</coordinates>
</Box>
</boundedBy>
</Feature>

The meaning of the coordinates has to be given elsewhere in the GML file. Remember that the code sequences given above are merely fragments of a GML file. Also most references to the attributes of elements has been purposely left out in order to simplify the presentation. The matter of element attributes will be dealt with below.

For another example of a feature, one that has a more complicated structure, consider Highway 101, a freeway which traverses the Silicon Valley.

<Feature typeName="Freeway">
<name>
Highway 101 in the Silicon Valley </name>
<description>
A major highway running through Santa Clara County, California with a northwest-southeast orientation
</description>
<geometricProperty>
<LineString>
<coordinates>
-123.5,38.7 -121.7,37.1
</coordinates>
</LineString>
</geometricProperty>
</Feature>

The Structure of a GML File

A GML file is an XML file and thus must include Document Type Definitions (DTD) as well as the coding for a geography document. The DTD's enable the computer to interpret the coding and determine whether it is valid for the structure given by the DTD's. The DTD's for a GML can be external as well as internal. Typically most of the structure comes from the external DTD's with only relatively minor elements defined within the GML file.

A user may want to use several external DTD's. A problem would arise if an element of the same name is defined in more than one place. The W3C formulated a method for avoiding the problem of conflicting definitions of terms used in XML files, include GML files. It is called namespace. Although this term sounds obscure the concept is relatively simple.

The Namespace Concept in XML

The XML file defines a name for a source of DTD's as given in a URL. The GML cites an element type in the notation of nmsp:element which means that the definition of element is to be found in the URL for the label nmsp. While namespace notation is an effective solution to the problem of conflicting definitions of terms in DTD's it does make the XML files less readable.

Attributes of Elements

Generally an element has an attribute list which provides a way of including important items of information about the element. For example, the Box element can have two attributes, an identification name and the name of the Spatial Resource System (srsName) that applies for its coordinates. The Spatial Resource Name is usually a reference to a standard document that gives information on units and coordinates system. The attribute list not only tells which attributes may be given for the element but whether each one is optional or mandatory.

The geometric classes of Point, LineString, Polygon, Multipoint, MultiLineString, MultiPolygon and GeometricCollection all have the same attribute list.

The W3C Resource Description Framework (RDF) Schema
(also referred to as Resource Description Format)

The RDF Schema is a set definitions of Classes for GML Geometry. For example, a Point class is defined which can reference a coordinates property. The Point class is defined by the code:


<rdfs:Class rdf:ID="Point">
<rdfs:subClassOf rdf:resource="#Geometry" />
</rdfs:Class>

As can be seen above the code uses the Resource Definition Format Schema namespace rdfs: and the Resource Definition Format namespace rdf:. Generally the RDF Schema is consistent with GML but gives the opportunity of going beyond GML. The RDF Schema is explained more fully elsewhere. Resource Description Framework.


HOME PAGE OF applet-magic
HOME PAGE OF Thayer Watkins
1