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.
The reference for shape decoding process is determined in the following way and order:
crsfield. This reference is used if you don't specify it in step 1 or 2.
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.
A Store instance, used by a LuciadRIA feature layer, uses this method on each Store.query invocation,
options parameter containing the data to decode.
If CodecDecodeOptions.reference option is present, the decoded features' shapes are encoded with this reference.
the decoding options
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
geometry is defined.
the corresponding LuciadRIA Shape.
a GeoJSON object
an object literal that contain the following optional properties:
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