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:

  1. Non-spatial Properties: Descriptive attributes such as names, identifiers, dates, or measurements.
  2. 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:

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