GML

Also known as Geographic Markup Language and GML/XML. GML is a text-based, XML format that can represent vector and attribute data. This is an Open Geospatial Consortium specification for data interchange. More information is available at https://www.ogc.org/standards/gml

File listing

GML files are usually a single text file with a GML filename extension. Some may use XML as the filename extension:

coal_dep.gml

XML schema documents often accompany GML files that have been translated from some other format (e.g. using the ogr2ogr utility).

GML uses sets of nested tags to define attributes and geometry coordinates. Example of text in a GML file:

<gml:featureMember>
<Coal_Deposits fid="1">
<UNKNOWN>0.000</UNKNOWN>
<NA>0.000</NA>
<ID>2</ID>
<ID2>2</ID2>
<MARK>7</MARK>
<COALKEY>110</COALKEY>
<COALKEY2>110</COALKEY2>
<ogr:geometryProperty>
<gml:Point>
<gml:coordinates>78.531,50.694</gml:coordinates>
</gml:Point>
</ogr:geometryProperty>
</Coal_Deposits>
</gml:featureMember>

Data Access / Connection Method

  • GML access is available in MapServer through OGR. More information on OGR GML support is available at https://gdal.org/drivers/vector/gml.html

  • The CONNECTIONTYPE OGR parameter must be used.

  • The path to the GML file is required, including file extension. There can be multiple layers in a GML file, including multiple feature types.

OGRINFO Examples

Using ogrinfo on a single GML file:

> ogrinfo /data/gml/coal_dep.gml

Had to open data source read-only.
INFO: Open of `coal_dep.gml'
using driver `GML' successful.
1: Coal_Deposits

Using ogrinfo to examine the structure of one layer:

> ogrinfo -summary /data/gml/coal_dep.gml Coal_Deposits

Had to open data source read-only.
INFO: Open of `coal_dep.gml'
using driver `GML' successful.

Layer name: Coal_Deposits
Geometry: Unknown (any)
Feature Count: 266
Extent: (23.293650, 37.986340) - (179.272550, 80.969670)
Layer SRS WKT:
(unknown)
UNKNOWN: Real (0.0)
NA: Real (0.0)
ID: Integer (0.0)
ID2: Integer (0.0)
MARK: Integer (0.0)
COALKEY: Integer (0.0)
COALKEY2: Integer (0.0)
LONG: Real (0.0)
LAT: Real (0.0)

Map File Example:

LAYER
  NAME "coal_deposits"
  TYPE POINT
  STATUS ON
  CONNECTIONTYPE OGR
  CONNECTION "gml/coal_dep.gml"
  CLASS
    STYLE
      COLOR 0 0 0
      SYMBOL 'circle'
      SIZE 6
    END #style
  END #class
END #layer