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:
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.
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 });
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.
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.
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).
Constructor options for GeoJsonCodec.