Live Online ConverterChannel: geojsongml

GeoJSON to GML Converter

Convert web JSON spatial objects into XML GML formats.

Format web maps for official enterprise storage. This upcoming tool maps coordinate features from lightweight GeoJSON files into standardized GML XML schemas, ensuring compatibility with municipal database structures.

Drag file here to convert, or select file

Supported file extension: .geojson, .json • Max 50MB

Channel: Direct Stream ModeGDAL Driver Operational

Specification Rules

  • Prepare web map designs for submission to official municipal archives
  • Format coordinate geometries to fit rigid xml structural models
  • Align vector datasets with enterprise GIS requirements
  • Produces structured XML that can be heavier to load than flat data types
  • Attribute types flat-map to basic string or numerical elements
  • Requires explicit schema definitions to match custom models

GDAL Direct Equivalent Terminal Command

sh — gdalready
$ogr2ogr -f GML output.gml input.geojson

When to use this conversion

Convert when you must publish data to a government INSPIRE feed, a cadastral exchange, or an OGC WFS service. GML is mandated by these contexts; nothing else satisfies the schema validation requirements.

Technical Details

GDAL writes GML 3.2.1 by default. Each GeoJSON Feature becomes a featureMember; geometries map to gml:Point, gml:LineString, gml:Polygon, etc. The srsName attribute is set from the source CRS or via -t_srs. Schema validation against a publisher-supplied XSD is a separate step (xmllint --schema).
Output file size

GML is typically 5–10× the size of the source GeoJSON. XML overhead, namespace declarations on every element, and verbose coordinate encoding all contribute. Compress with gzip before transport.

Common Errors & Fixes

  • Output doesn't validate against publisher's XSD: feature types are not the right schema. Fix: post-process to rename feature elements, or use a publisher-provided template.
  • CRS unrecognised by recipient: srsName URI format wrong. Fix: pass -dsco SRSNAME_FORMAT=OGC_URN or similar to match the publisher's expected format.
  • GML version wrong: recipient wants 2.x but GDAL produced 3.2.1. Fix: use -dsco FORMAT=GML2 to target legacy versions.
  • Properties don't become typed elements: GeoJSON's schema-free properties don't match strict GML feature types. Fix: build a custom mapping in FME or by hand.

Alternative Tools

  • QGIS: export features as GML (choose GML version in the dialog)
  • ogr2ogr CLI: ogr2ogr -f GML output.gml input.geojson
  • FME with INSPIRE templates for strict schema-compliant output
  • PostGIS: ST_AsGML for query-level GML generation

Frequently Asked Questions

Which version of GML is generated?

By default, the converter uses GML 3.2.1 schemas, but you can select alternative versions using configuration tags.

Are coordinate spatial projections adjusted?

We map coordinates in WGS 84 (EPSG:4326), but we can adjust target projections during processing.

Does GML preserve custom descriptive properties?

Yes. Spatial properties translate into XML schema fields, ready for database imports.

Related Transformations Map