What this GML viewer does
GML (Geography Markup Language) is the XML format that governments, mapping agencies and WFS web services use to share geographic data. If you downloaded a .gml file from a cadastre, an INSPIRE download service or a WFS GetFeature request, you probably saw that most apps cannot open it. A web browser shows only the XML text, and many online map tools skip the format.
This viewer opens the file directly. Drop a .gml or .xml file on the map (a .zip or .gz archive with a GML file inside also works) and it reads the features, finds the coordinate system, converts the coordinates to longitude and latitude, and draws every feature type as a separate layer with its own color. The sidebar shows the GML version, how many feature types and features the file has, which coordinate system it uses and whether the axis order had to be swapped. Tap a feature to read its attributes.
Most GML files that appear in the wrong place have an axis-order or coordinate-system problem, so I built a fix for both into the viewer: automatic axis detection, and a "Coordinate system" box where you can type an EPSG code or a PROJ string and swap X and Y with one tick. When the map looks right, download one feature type or the whole file as GeoJSON. Nothing is uploaded, and the layout works well on a phone.
GML vs GeoJSON, KML and Shapefile
All four formats store geometry and attributes. They differ in who designed them and how much they describe.
| Aspect | GML | GeoJSON | KML | Shapefile |
|---|---|---|---|---|
| Standard | OGC and ISO 19136 | IETF RFC 7946 | OGC KML 2.2 | Esri specification (open) |
| File type | XML text, often large | JSON text | XML text | Several binary files (.shp, .shx, .dbf) |
| Coordinate order | Depends on the CRS: latitude first for EPSG:4326 in urn: names | Always longitude, latitude | Always longitude, latitude, altitude | X, Y (easting, northing or longitude, latitude) |
| Coordinate system | Any, named in srsName | WGS 84 only | WGS 84 only | Any, stored in the .prj file |
| Attributes | Any, described by an XML schema (.xsd) | Free-form properties | Name, description and extended data | A table in the .dbf file, field names up to 10 characters |
| Typical use | WFS services, INSPIRE, cadastre, data exchange between agencies | Web maps and APIs | Google Earth, display and sharing | Desktop GIS and file exchange |
My rule of thumb: GML is the format you receive from official sources, and GeoJSON is the format you want to work with on the web. Keep the GML as the original and export a GeoJSON copy for everything else.
What is inside a GML file
A GML file is plain XML. A typical download from a WFS service has a collection element, then one member element per feature, and each feature has attributes and one geometry. These are the parts you will meet most often:
- srsName
- An attribute on a geometry (or on a
gml:Envelope) that names the coordinate system, for exampleurn:ogc:def:crs:EPSG::4326orEPSG:25832. It tells you how to read the numbers. - featureMember, member
- Wrapper elements around each feature. GML 2 and 3.1 use
gml:featureMember, WFS 2.0 useswfs:member. Inside is the feature itself, named after its feature type, such asex:parcel. - gml:id
- The unique id of a feature. The viewer shows it as the
gml_idattribute and uses it as the GeoJSON id. - gml:pos, gml:posList
- The coordinates, written as numbers separated by spaces.
posholds one point andposListholds a whole line or ring. GML 2 usesgml:coordinateswith commas instead. - exterior, interior
- The outer ring and the holes of a polygon in GML 3. GML 2 calls them
outerBoundaryIsandinnerBoundaryIs. - Curve, Surface
- GML 3 geometries that can contain arcs and patches. The viewer draws arcs as smooth lines and surfaces as polygons.
- Attributes
- Every other element of a feature, for example
ex:nameorex:population. They become the attributes you see in the popup.
Here is a complete small file with one polygon, written the way a WFS 2.0 server writes GML 3.2:
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ex="http://example.com/ns">
<wfs:member>
<ex:park gml:id="park.1">
<ex:name>Vondelpark</ex:name>
<ex:geom>
<gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" gml:id="park.1.geom">
<gml:exterior><gml:LinearRing>
<gml:posList>52.3579 4.8686 52.3579 4.8800 52.3620 4.8800
52.3620 4.8686 52.3579 4.8686</gml:posList>
</gml:LinearRing></gml:exterior>
</gml:Polygon>
</ex:geom>
</ex:park>
</wfs:member>
</wfs:FeatureCollection>The srsName is urn:ogc:def:crs:EPSG::4326, so the official axis order applies: latitude first. The first pair 52.3579 4.8686 is latitude 52.3579, longitude 4.8686, which is the Vondelpark in Amsterdam. Read as longitude first, the same numbers put the polygon in the Indian Ocean.
Technical details
This is exactly what the viewer reads and shows.
- Accepted files
.gmland.xmlfiles, and.zipor.gzfiles that contain one, up to 60 MB. Files in UTF-8 or in any encoding named in the XML header (for example ISO-8859-1) are read correctly.- GML versions
- GML 2, GML 3.1 and GML 3.2, including WFS 1.x and 2.0 FeatureCollection responses, GML 3.2 simple feature downloads and OGR output.
- Geometry types
- Point, LineString, LinearRing, Polygon, MultiPoint, MultiLineString, MultiPolygon, MultiCurve, MultiSurface, MultiGeometry, Curve (line segments and arcs), Surface, CompositeCurve, CompositeSurface, OrientableCurve, OrientableSurface and Solid (drawn from its faces, in 2D).
- Feature types
- Every kind of feature becomes its own layer, with a checkbox, a color, its geometry type, its feature count, its field count and a GeoJSON download.
- Attributes
- Simple elements become attributes. Nested elements are flattened with dots, for example
address.city. Numbers stay numbers, and codes with a leading zero stay text. Thegml:idis added asgml_id. - Coordinate systems
- WGS 84 and the equivalent ETRS89, NAD83, GDA94 and GDA2020, Web Mercator, every UTM zone, and national systems such as RD New (28992), British National Grid (27700), Lambert-93 (2154), ETRS89-LAEA (3035), CH1903+ (2056) and the Gauss-Krüger zones (31466 to 31469). Any other system works when you paste its PROJ string. Datum differences below about 2 m are ignored.
- Axis order
- Read from the srsName and checked against the numbers. If the result looks wrong, tick "Swap X and Y" and press Apply.
- Limits
- Features without a geometry are counted in a message and not drawn. Arcs are drawn as smooth lines. Heights are ignored, so 3D data is drawn in 2D.
- Export
- Each feature type as its own GeoJSON file, or all types in one file with a
gml_feature_typeattribute. - Basemap
- Street map by default, with a satellite option. Set the fill opacity to 0 to see only the outlines.
- Phones and tablets
- On a small screen the layout changes to one column: controls above the map, the sidebar below it, with large buttons for your fingers.
- Privacy
- The file is read and converted in your browser. Nothing is sent to a server.
Why a GML file shows up in the wrong place
Two things go wrong again and again: the axis order and the coordinate system. Both are easy to fix once you know what to look for.
The latitude-first trap
The official definition of EPSG:4326 lists latitude before longitude. GML 3 and WFS 1.1 and 2.0 follow it when the srsName is written as a urn, so the coordinates arrive as latitude, longitude. GeoJSON and most web maps use the opposite order. If you plot such numbers as x, y, the data is mirrored across the diagonal and often lands in the wrong ocean.
urn:ogc:def:crs:EPSG::4326 52.3676 4.9041 (latitude, longitude) EPSG:4326 4.9041 52.3676 (often longitude, latitude)
The viewer reads the srsName and then checks the numbers: values that cannot be latitudes rule an order out. When both orders are possible, it follows the srsName. If the map still looks wrong, tick "Swap X and Y".
Projected coordinates
Many national files do not use degrees at all. They use meters in a projected system, for example RD New in the Netherlands, where Amsterdam is near 121000 487000. These numbers only make sense together with the right EPSG code, and the viewer uses the srsName to turn them into longitude and latitude.
EPSG:28992 (RD New) 121000 487000 -> 52.370 N 4.888 E EPSG:25832 (UTM 32N) 500000 5700000 -> 51.451 N 9.000 E
If the file has no srsName, or a code the viewer does not know, you get a message and not a wrong map. Type the EPSG code you know the data uses, or paste a PROJ string, and press Apply.
How to find the right code
Look for srsName in the file, often on the first geometry or in the boundedBy element. If it is missing, check the metadata of the download, the .xsd schema or the website the data came from. Agencies in Europe usually publish in ETRS89: EPSG:4258 for degrees, or a UTM or national grid code for meters. The EPSG number of a national grid is easy to find on epsg.io, which also shows its PROJ string.
How to view a GML file, step by step
Here is the whole workflow with the built-in sample: 50 European countries and 22 capital cities from Natural Earth, written as a WFS 2.0 response in GML 3.2 with latitude-first coordinates, the way a real server sends them.

The map opens with a street basemap. Use Upload, drag a file onto the map, or tap Sample Data. On a phone the controls sit above the map and the sidebar is below it.

The file is read in your browser and every feature type is drawn in its own color. File Info shows the GML version, the number of feature types and features, the coordinate system and the axis order that was found.

The Feature types panel lists each type with its geometry and feature count. Untick a type to hide it, or tap its color square to change the color.

The Coordinate system panel is where you fix a file that lands in the wrong place. Type an EPSG code such as 28992 or a PROJ string, tick "Swap X and Y" if needed, and press Apply.

Click or tap any feature to open its attributes. The popup names the feature type and shows the gml_id and every attribute from the file.

Use the GeoJSON link next to a feature type to download just that type, or Download All as GeoJSON for everything in one file.
Other ways to open and convert GML
This viewer is for looking at a file quickly. These are the other tools I use when a GML file needs real work.
QGIS
QGIS opens GML through GDAL. Choose Layer, Add Layer, Add Vector Layer and pick the file. Each feature type appears as its own layer. Right-click a layer and choose Export, Save Features As to write GeoPackage, Shapefile or GeoJSON.
ArcGIS
ArcGIS reads GML through the Data Interoperability extension (Quick Import). Without the extension, convert the file in QGIS or with ogr2ogr first, and then add the result to your project.
GDAL and ogr2ogr
GDAL has a GML driver. ogrinfo lists the feature types, their fields and the coordinate system, and ogr2ogr converts to GeoJSON, GeoPackage or Shapefile and can reproject with -t_srs EPSG:4326.
Python and R
GeoPandas reads GML through GDAL, one feature type (layer) at a time. In R, sf::st_read("data.gml") does the same.
The same jobs in code
These commands list the feature types in a GML file, convert it to GeoJSON and GeoPackage, and read it in Python.
# GDAL / OGR
ogrinfo -so -al data.gml # feature types, fields and the CRS
ogr2ogr -f GeoJSON out.geojson data.gml -t_srs EPSG:4326
ogr2ogr -f GPKG out.gpkg data.gml
# Python: GeoPandas reads GML through GDAL, one feature type (layer) at a time
import geopandas as gpd
parcels = gpd.read_file("data.gml", layer="park").to_crs(4326)My take: treat the GML you receive as the source of truth, and convert a copy. GeoJSON or GeoPackage is easier to edit and share, and you can always check the result against the original here.
Typical uses
People open GML files for many practical reasons. These are the most common.
- Check a WFS download. You sent a GetFeature request to a WFS service and got a .gml file back. Open it here to see whether it covers the right area and has the right attributes before you load it into a project.
- Open government and INSPIRE data. Many data portals publish parcels, addresses, buildings and protected sites as GML. Open the file to see what you really received.
- Find out why a file is in the wrong place. When a GML layer lands in the ocean or off the coast of Africa, the axis order or the coordinate system is wrong. The sidebar shows what the viewer found, and you can try other values on the spot.
- Open a file without GIS software. You are on a Chromebook, on a phone or on a laptop without QGIS, and someone sent you a .gml file. Open it in the browser. There is nothing to install.
- Convert GML to GeoJSON. Export one feature type, or all of them, as GeoJSON for Leaflet, Mapbox or any tool that does not read GML.
- Check data before you send it. You exported GML from a planning or cadastre system. Open it to confirm that the geometries, the attributes and the coordinate system are what the receiving agency expects.
- Teach GML and WFS. Students can load a small file, see how a posList becomes a polygon and compare the two axis orders. The sample file in the viewer is a good start.
- Read attributes quickly. Tap features to read names, codes and dates without scrolling through thousands of lines of XML.
Frequently asked questions
1. What is a GML file?
GML stands for Geography Markup Language. It is an XML format, standardized by the OGC and by ISO (ISO 19136), that stores geographic features: their geometry (points, lines, polygons) and their attributes. Agencies and WFS web services use it to exchange data.
2. How do I open a GML file?
The quickest way is this viewer: press Upload, or drag the file onto the map, and the features appear. To edit the data, open the file in QGIS with Layer, Add Layer, Add Vector Layer, or convert it with ogr2ogr. A text editor shows only the XML.
3. How can I view a GML file online without installing software?
Open this page, press Upload and choose your .gml file. Everything runs in your browser, so there is nothing to install and nothing to log in to. It works on phones and tablets too.
4. How do I convert GML to GeoJSON?
Open the file here and press Download All as GeoJSON, or use the GeoJSON link next to one feature type. The coordinates are converted to longitude and latitude (WGS 84), which GeoJSON requires. On the command line, ogr2ogr -f GeoJSON out.geojson in.gml -t_srs EPSG:4326 does the same job.
5. Why does my GML file appear in the wrong place?
Almost always the axis order or the coordinate system. With urn:ogc:def:crs:EPSG::4326 the numbers are latitude first. The viewer detects this, but if your file has no srsName or an unusual one, type the EPSG code in the Coordinate system box, or tick "Swap X and Y", and press Apply.
6. Which coordinate systems does the viewer support?
WGS 84 and its equivalents, Web Mercator, every UTM zone and many national grids, for example RD New, British National Grid, Lambert-93, ETRS89-LAEA, CH1903+ and Gauss-Krüger. For any other system, paste its PROJ string, which starts with +proj.
7. Can it open GML from a WFS or an INSPIRE download?
Yes. WFS 1.x and 2.0 FeatureCollection responses (with featureMember or member elements) and GML 3.2 simple feature files open directly. A .zip that contains the GML file works too.
8. Does it open .xml files?
Yes, as long as the XML contains GML features. WFS servers often save their answer as .xml, and the viewer reads it the same way as .gml.
9. Is my file uploaded to a server?
No. The file is read and converted in your browser. It is not sent to OnlineMapMaker or to any other server. Only the basemap tiles come from the internet.
10. What is the maximum file size?
Up to 60 MB for the file you choose (a ZIP or GZ file counts at its compressed size). Files with several hundred thousand features can be slow, especially on a phone. For those, filter or convert the data in QGIS or with ogr2ogr first.
11. Does it work with CityGML or 3D data?
The viewer is made for 2D GML feature data. CityGML 3D city models are outside its scope, so use a 3D viewer for those.
12. What is the difference between GML and XML?
XML is a general way to write structured text. GML is a set of XML rules for geographic data: it defines how to write points, lines, polygons and coordinate systems. Every GML file is XML, but not every XML file is GML.
Libraries and data
This viewer is built on open source software and open data. Many thanks to the people behind these projects.
- proj4js 2.x · MIT · Proj4js contributorsConverts projected coordinates (UTM, national grids and others) to longitude and latitude.
- JSZip 3.x · MIT or GPL-3.0 · Stuart Knightley and contributorsOpens a GML file that is packed in a ZIP archive.
- Leaflet 1.9 · BSD-2-Clause · Volodymyr Agafonkin and contributorsDraws the interactive map, the layers and the popups.
- Natural Earth (1:50m Admin 0 countries) · Public domain · Natural Earth contributorsCountry borders used in the sample file.
- OpenStreetMap, Protomaps (hosted by KONAKTIVE), CARTO, Esri World Imagery · ODbL and provider terms · OpenStreetMap contributors, Protomaps, KONAKTIVE, CARTO, EsriBasemap tiles and imagery.
Related GIS file viewers
GML files are read and converted in your browser. No file is ever uploaded to a server. The viewer shows the data as it is stored in the file, and datum shifts below about 2 m are ignored, so do not use it for surveying. The sample uses Natural Earth data (public domain). Map tiles © OpenStreetMap contributors, drawn with Protomaps (hosted by KONAKTIVE), with CARTO as the fallback. Satellite imagery: Esri.
