A GMLCodec is responsible for decoding a GML document object into a set of LuciadRIA Feature objects containing LuciadRIA geometries and properties.

The codec decodes GML geometries to LuciadRIA shapes as follows:

  • 'Point' is mapped to a Point instance.
  • 'LineString' is mapped to a Polyline instance.
  • 'Polygon' and 'PolygonPatch' is mapped to a Polygon, if there is no interior 'Ring', or to a ComplexPolygon, if at least one interior 'Ring' is defined.
  • 'Curve' is mapped to a Circle or a Circle instances.
  • 'Surface' is mapped to a Polygon instances (if the GML geometry does not define the interior 'Ring'), and ComplexPolygon instances (if the GML geometry defines at least one interior 'Ring').
  • 'MultiPoint', 'MultiLineString', 'MultiPolygon', 'MultiCurve' and 'MultiSurface' are all mapped to a Polygon, Circle instances.
  • Envelopes are mapped to Bounds.
The current implementation of GMLCodec is limited to the decoding of features containing the aforementioned geometry elements. Encoding is currently not supported.

A GMLCodec can be used in combination with a WFSFeatureStore to decode GML data directly from a WFS service.

  const storePromise = WFSFeatureStore.createFromURL("http://sampleservices.luciad.com/wfs", "usrivers", {
codec: new GMLCodec(),
outputFormat: "text/xml; subtype=gml/3.1.1"
});

A GMLCodec can also be used to decode a file directly from a url, using a UrlStore:

  //Create a Store with a GeoJson codec to decode the data
const store = new UrlStore({
target: url,
codec: new GMLCodec()
});

//Use the store to create a model
const model = new FeatureModel(store);

//Create a layer for the model
const layer = new FeatureLayer(model);

//Add the layer to the map
map.layerTree.addChild(layer);

Spatial reference

The reference for shape decoding process is determined in the following way and order:

  • The reference passed to decode. Use it in case you want to override the reference for each decode request.
  • The reference passed to the constructor. Allows you to set the reference yourself, overriding what is in the data. If you still want to override for a particular decode() operation, you can still do it, because the step 1 allows it.
  • The reference specified in the data with the legacy crs field. This reference is used if you don't specify it in step 1 or 2.
  • The specification default WGS:84 reference is used.

Supported versions

LuciadRIA supports the GML 3.1 and GML 3.2 specifications, with the following limitations:

  • The files must adhere to the Simple Feature Level-0 profile.
  • It is assumed that all geometries use the same reference.
  • Envelopes are not decoded.

LuciadRIA supports the GML Circle (a circle defined by 3 points) and GML CircleByCenterPoint geometries, described in GML 3.2.1 specification. Circle geometries are interpolated to Polyline instances.

Type Parameters

  • TFeature extends Feature = Feature

    Represents the type of Feature instances that are decoded by the codec. Default type is Feature without restrictions on shape and properties.

Hierarchy

Constructors

Methods

Constructors

Methods