What it reads
Extract useful features from an ambitious XML standard.
GML covers a very broad space. GMLLoader focuses on the common feature-collection and geometry path, with a streaming mode that emits complete features as the response arrives.
Input
GML feature collections and responses
Geometry
Points, lines, polygons, and multiparts
Output
Arrow feature tables or explicit GeoJSON
Streaming
Feature batches for large WFS responses
Detailed guide
GMLLoader reference
The sections below document usage, parsed data, streaming behavior, options, and the supported subset.
The GMLLoader parses the XML-formatted response from the
the OGC-standardized GML (Geographic Markup Language) file format into a standard geospatial feature table.
Note that the GML standard is very ambitious and full support of the format is out of scope.
| GMLLoader | |
|---|---|
| File Extension | .gml |
| File Type | Text |
| File Format | GML |
| Data Format | Arrow table with GeoArrow WKB geometry |
| Decoder Type | Synchronous |
| Worker Thread | ❌ No |
| Streaming Support | Feature collections |
Usage
import {GMLLoader} from '@loaders.gl/ogc/wms';
import {load} from '@loaders.gl/core';
// Form a GML request
const url = `${WFS_SERVICE_URL}?REQUEST=GetFeature&...`;
const data = await load(url, GMLLoader, options);
Parsed Data Format
The GMLLoader supports the standard geospatial subset of geometries (points, multipoints, lines,
linestrings, polygons and multipolygons). By default, it returns
an Apache Arrow Table. Feature properties and IDs become columns and geometry uses
geoarrow.wkb. A bare geometry becomes a one-row table; an empty result becomes an empty table.
Coordinates are not reprojected, and CRS metadata is explicitly unknown (crs: null); this loader
does not yet resolve GML srsName into Arrow CRS metadata.
Set gml.shape: 'geojson' to retain the previous FeatureCollection, bare geometry, or null result.
Arrow conversion rejects properties that collide with the output geometry column or a feature
ID's id column; explicit GeoJSON retains both values.
The root GMLLoader is metadata-only (_GMLLoader remains an alias). Synchronous parsing uses
GMLLoaderWithParser from @loaders.gl/ogc/gml.
For large WFS responses, the parser-bearing loader also supports incremental feature batches:
import {parseInBatches} from '@loaders.gl/core';
import {GMLLoader} from '@loaders.gl/ogc/wms';
for await (const batch of await parseInBatches(response.body, GMLLoader, {
gml: {batchSize: 500}
})) {
console.log(batch.numRows);
}
The streaming path emits complete featureMember / featureMembers features as they become
available and keeps incomplete fragments buffered. Each Arrow batch infers its own property
schema; heterogeneous batches can have different schemas. Bare geometries use whole-file parsing.
Explicit gml.shape: 'geojson' returns FeatureCollection batches. WFS source output remains
controlled by the WFS format option.
Options
| Option | Type | Default | Description |
|---|---|---|---|
gml.shape | 'arrow' | 'geojson' | 'arrow' | Whole-file and streaming output shape. |
gml.batchSize | number | 1000 | Feature count per streaming batch. |
gml.propertyTypes | Record<string, GMLPropertyType> | — | XML Schema scalar types keyed by local property name. |
gml.transformCoords | (...coordinates: number[]) => number[] | Identity | Optional coordinate transformation. |