A GeoJsonCodec is responsible for 2 things:
Since a 1-on-1 mapping from a GeoJSON geometry to a LuciadRIA shape does not exist, the codec decodes GeoJSON geometries to shapes as follows:
The codec encodes the shape of the feature to GeoJSON geometries as follows:
GeoJSON does not support any other shapes than
As such, it cannot support all shapes of LuciadRIA.
For example, a Circle cannot be represented directly as a circle in GeoJSON.
To deal with such shapes, a custom codec is required.
The CreateEdit sample shows how you can create a custom codec for such shapes.
LuciadRIA supports the full feature set of GeoJSON with the following limitations:
Creates a GeoJSON codec. By default, a GeoJSON Codec decodes 2D geometry which means the z coordinates
of points (which usually contains height) is ignored. If the z coordinate must be encoded or decoded
as well, pass
true to the
mode3D property in the
an object literal that contains configuration settings for the codec.
Decodes a GeoJSON geometry string to a Shape.
The string representation of a shape. The codec assumes this string adheres to the GeoJSON specification
The spatial reference in which the
the corresponding LuciadRIA Shape.
a GeoJSON object
an object literal that contain the following optional properties:
the spatial reference in which the
Feature instances are defined.
This is an optional parameter.
A typical value for this parameter would be the reference of the FeatureModel
in which the returned
Feature instances will be added.
This reference will only be used in case the reference is not specified in the response.
Features corresponding to the server response.
Cursor of LuciadRIA
Features which must be encoded to
the arbitrary representation
An object containing two properties:
content: the encoded content as a
String. This is valid GeoJSON
contentType: the mime type as a
String. It equals "
The encoded content as a
The mime type describing how the content was encoded as a