What Is Geography Markup Language (GML)?
Geography Markup Language (GML) is an XML-based encoding standard developed by the Open Geospatial Consortium (OGC) and standardized under ISO 19136 to express geographical features. This article provides a clear overview of what GML is, how it models spatial and non-spatial data using XML grammar, and how it enables seamless data interchange across diverse Geographic Information Systems (GIS).
Understanding Geography Markup Language (GML)
Geography Markup Language serves as an open, vendor-neutral standard for modeling, transporting, and storing geographic information. Instead of relying on proprietary binary formats, GML utilizes Extensible Markup Language (XML) syntax. This makes geographic data human-readable, machine-parsable, and easily transmittable over the web via standard protocols like HTTP.
In GIS workflows, GML acts as the default data exchange format for OGC web services, particularly Web Feature Service (WFS), allowing different mapping platforms to share vector data without format conversion conflicts.
How GML Represents Spatial Data
GML models the world using the concept of Features. A feature is an abstraction of a real-world phenomenon (such as a road, a river, a building, or a boundary). A GML feature consists of two primary components:
- Non-spatial Properties: Descriptive attributes such as names, identifiers, dates, or measurements.
- Spatial Properties (Geometry): The mathematical description of the feature’s location and shape.
Geometric Elements in GML
GML defines basic and complex geometric primitives within dedicated XML tags. Common geometry elements include:
<gml:Point>: Defines a single location using coordinate pairs (<gml:pos>).<gml:LineString>: Defines linear paths using a sequence of points (<gml:posList>).<gml:Polygon>: Defines bounded planar surfaces using outer boundaries (<gml:exterior>) and optional inner boundaries (<gml:interior>) for holes.- Aggregates and Complexes: Structures like
<gml:MultiPoint>or<gml:MultiSurface>to represent multi-part geometries.
Coordinate Reference Systems (CRS)
Spatial coordinates are meaningless without context. GML embeds
spatial reference systems directly into geometry elements using the
srsName attribute (typically referencing an EPSG code).
This ensures that parsing software projects coordinates correctly onto
the Earth’s surface.
Example: Spatial XML Representation in GML
Below is a standard example showing how a geographic feature (a landmark building) is encoded in GML:
<Landmark gml:id="landmark.101" xmlns:gml="http://www.opengis.net/gml/3.2">
<!-- Non-spatial properties -->
<name>Central City Tower</name>
<height units="meters">185</height>
<yearBuilt>2015</yearBuilt>
<!-- Spatial geometry property -->
<location>
<gml:Point srsName="urn:ogc:def:crs:EPSG::4326">
<gml:pos>37.7749 -122.4194</gml:pos>
</gml:Point>
</location>
</Landmark>In this representation: * <Landmark> defines the
application-specific feature. * <name>,
<height>, and <yearBuilt> store
standard alphanumeric metadata. * <location> wraps
the spatial geometry. * <gml:Point> and
<gml:pos> define the latitude and longitude
coordinates according to the EPSG:4326 coordinate reference system.
Key Benefits of GML
- Interoperability: Decouples spatial data from specific software vendors or database engines.
- Extensibility via Application Schemas: Developers can create domain-specific standards built on top of GML, such as CityGML (for 3D urban models) and WaterML (for hydrological data).
- Support for Complex Data: Beyond basic 2D shapes, GML supports 3D geometries, topological networks, temporal properties (features that change over time), and coordinate transformations.