GML to GeoJSON Converter
Extract complex XML geodata as web-friendly JSON.
Translate enterprise Geography Markup Language (GML) structures into lightweight web models. This tool removes nested XML schema tags and maps coordinates into flat GeoJSON structures.
Drag file here to convert, or select file
Supported file extension: .gml • Max 50MB
Specification Rules
- Publish official GML cartography datasets directly on web maps
- Parse government GIS XML databases into formats for web developers
- Clean up nested XML coordinate schemas
- Strips complex GML feature relationship associations
- Nested XML attributes flat-map to simple horizontal parameters
- Vast regional datasets are subject to file size limits
GDAL Direct Equivalent Terminal Command
When to use this conversion
Convert when a GML file from a government data portal, an INSPIRE feed, or a cadastral exchange needs to enter a web mapping workflow. GeoJSON is the right web pivot; GML is too verbose for browser delivery.
Technical Details
GeoJSON is typically 10–25% the size of the source GML. XML overhead is enormous; JSON compression is dramatic for typical government feature data.
Common Errors & Fixes
- Empty output: feature type not recognised because the .gfs is missing. Fix: open the .gml in QGIS once to generate a .gfs sidecar, then re-run ogr2ogr.
- Geometry not parsed: complex GML constructs like gml:Surface with curve segments unsupported. Fix: preprocess with FME or ask the publisher for simpler geometry.
- Properties flattened weirdly: nested XML elements become long flat column names. Fix: use a custom mapping or post-process the output.
- Wrong CRS: source srsName not recognised. Fix: identify the EPSG code and pass -s_srs explicitly.
Alternative Tools
- QGIS: open the .gml, export as GeoJSON with target CRS = EPSG:4326
- ogr2ogr CLI: ogr2ogr -f GeoJSON -t_srs EPSG:4326 output.geojson input.gml
- FME for complex GML profiles with relations and topology
- Python lxml + custom mapping code for non-standard schemas
Frequently Asked Questions
Will complex spatial attributes be saved?
GML schemas translate GML features into standard database tables, mapping variables into standard text elements.
How do of coordinate references apply?
The parsing system reads coordinates based on the SRS parameter in the XML and projects them for global web mapping suitability.
Are multiple coordinate definitions supported?
Yes, standard spatial geometries like lines and polygons are mapped during the conversion.