Standards-Compliant XML.gml · .xmlMIME: application/gml+xml

GML

The XML grammar of choice for cadastral and government GIS data.

Specification
OGC GML 3.2.1 / ISO 19136
Released
1999 (GML 1.0); 3.2.1 in 2007
When to use
Use GML when you have to ingest or produce data for a government INSPIRE feed, a cadastral exchange (German ALKIS NAS, Dutch BAG, French Cadastre), an OGC WFS service, or any other standards-driven public sector workflow. For private use, almost any other vector format is more practical.

What is GML?

GML (Geography Markup Language) is an OGC standard, also published as ISO 19136, that defines an XML grammar for expressing geographic features, geometries, coordinate reference systems, observations, and topology. Unlike GeoJSON or Shapefile, GML is not a single file format with a fixed schema — it is a meta-format. Each application profile (ALKIS NAS in Germany, CityGML for 3D buildings, S-100 for hydrography, INSPIRE schemas across Europe) defines its own XML schema that constrains which GML constructs are allowed and which feature types may appear. A plain GML 3.2.1 file contains a root element holding featureMember or featureMembers wrappers; each member is a typed feature whose schema is defined elsewhere by .xsd files. Geometries are encoded as gml:Point, gml:LineString, gml:Polygon, gml:MultiSurface, and so on, each carrying a srsName attribute pointing to a CRS URI (typically an EPSG code). The strength of GML is rigour: schemas are validated, types are strong, and the format handles topology, complex hierarchies, and multilingual labels natively. The weakness is verbosity — a single point can take 500 bytes that GeoJSON would express in 30 — and the practical need for an application-specific parser to make sense of the contents.

Supported by

  • GDAL/OGR (drivers: GML, NAS for cadastral)
  • QGIS (read/write)
  • ArcGIS (Data Interoperability extension)
  • FME (deep support — gold standard for GML)
  • deegree, GeoServer (server-side)
  • INSPIRE clients across EU agencies
  • Custom Java/Python parsers with xmlschema/lxml

Strengths

  • Schema-validated — type-safe data with strong contracts
  • Native CRS handling per geometry, not per file
  • Supports topology, relations, and complex feature hierarchies
  • Mandated by INSPIRE and many national spatial data infrastructures
  • Open OGC/ISO standard

Weaknesses

  • Extremely verbose XML — files are large and slow to parse
  • Every application profile uses a different schema
  • Specialist tools (NAS driver for ALKIS) needed for many real-world flavours
  • No human-friendly inspection — XML editor required
  • Round-tripping to flat formats loses schema and topology information

Converters for GML

Validator

GML Validator

Validate a GML file for XML schema compliance, geometry encoding, and spatial reference system definitions.

Frequently Asked Questions

Why is GML so much larger than GeoJSON?

XML overhead. Each coordinate pair in GML is wrapped in element tags (e.g. <gml:pos>53.5 10.0</gml:pos>) with namespace prefixes; GeoJSON writes the same pair as [10.0, 53.5]. Expect GML files to be 5–10× the size of equivalent GeoJSON. The trade-off is that XML is self-describing and schema-validatable.

What is ALKIS NAS and how does it relate to GML?

ALKIS (Amtliches Liegenschaftskatasterinformationssystem) is the German federal cadastre standard. Its exchange format is NAS (Normbasierte Austauschschnittstelle), which is a GML 3.2.1 application profile with a deeply nested AdV-defined schema. GDAL's NAS driver is a specialised version of its GML driver that understands this schema directly.

Why do INSPIRE feeds use GML?

The EU INSPIRE directive (2007) mandates standardised, machine-readable spatial data across member states. GML was chosen because it is an open OGC/ISO standard, schema-validatable, and supports the complex feature types (administrative boundaries, hydrography, transport networks) that the directive defines. Each INSPIRE theme has its own XSD schema.

Can I open a GML file in QGIS?

Usually yes. Simple GML files load directly. Complex GMLs (ALKIS NAS, CityGML, INSPIRE) often require GDAL to be built with libxml2 support and a configured GFS (GML Feature Schema) file alongside the .gml. For consistent results, convert to GeoPackage first using ogr2ogr.

What's the difference between GML and CityGML?

CityGML is a GML application profile for 3D city models — buildings, terrain, vegetation, transport. It defines specific feature types like Building, TINRelief, and WaterBody, with levels of detail (LoD0–LoD4). Any CityGML file is a valid GML file, but a CityGML parser additionally understands the city-modelling semantics.

Related Formats