• Public
  • Public/Protected
  • All

Interface GeoJsonCodecConstructorOptions

Constructor options for GeoJsonCodec.


  • GeoJsonCodecConstructorOptions



Optional encodeShapeListAsGeometryCollection

encodeShapeListAsGeometryCollection: boolean

The property defines how a LuciadRIA ShapeList instance should be encoded to the GeoJson format. By default a LuciadRIA ShapeList instance in encoded to a specific GeoJson geometry, depending on its children:

  • if all children are Point instances -> MultiPoint
  • if all children are Polyline instances -> MultiLineString
  • if all children are Polygon or ComplexPolygon instances -> MultiPolygons
  • otherwise -> GeometryCollection
Set the value to 'true' if you want to encode a LuciadRIA ShapeList always as a GeometryCollection.


Optional generateIDs

generateIDs: boolean | null

When true, the codec will always generate IDs during the decoding step for all the Features. When the Feature has already an ID, the existing ID will be replaced by a generated one. Feature IDs are provided by the GeoJsonCodecConstructorOptions.idProvider mechanism or otherwise they are auto-generated by the internal ID generator.
When false, the codec will never generate IDs. The codec will throw an error whenever a Feature without ID is encountered.
When the flag is not set, or is set to null, the codec will generate IDs only for those Features that are without IDs.

Optional idProvider

idProvider: FeatureIDProvider

Defines a custom callback function to provide IDs for decoded features that come without IDs. The mechanism takes into account the GeoJsonCodecConstructorOptions.generateIDs property. This callback is invoked by LuciadRIA with a decoded feature for which the ID should be returned. When the provided ID is invalid then the feature ID will be auto-generated.

Note: Having features in LuciadRIA with stable IDs that do not change on each query request is important for the performance sake. For example when features do not have intrinsic IDs on each query request then instead of adding/removing only relevant features, all the existing features are removed, and all the new ones are added.

// GeoJsonCodec will use IDs from a feature property.
const codec = new GeoJsonCodec({ idProvider: (feature: Feature) => feature.properties.id });


Optional mode3D

mode3D: boolean

Setting this property to true will encode Shape instances as 3D GeoJSON geometry and decode GeoJSON geometries as 3D Shapes: if LuciadRIA Point instances have no z coordinate, 0 will be included as a third value in a GeoJSON position. if GeoJSON positions have a third value, it will be set as the z-coordinate in the LuciadRIA Point. By default this is false.

Optional reference

The reference in which the Feature instances will be defined when decoding GeoJSON data. Make sure the reference on your FeatureModel is the same as the reference on this codec.



Optional swapAxes

swapAxes: string[]

Indicates whether the codec should swap x and y axes for the specified reference identifier(s) when decoding or encoding features in the GeoJSON format. Normally axes should always be in x,y[,z] order when in GeoJSON, but not all servers follow this rule (depending on the reference system).


  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method