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 options
object.
an object literal that contains configuration settings for the codec.
the decoding options
featureCursor A Cursor
of Feature
s corresponding
to the server response.
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.
Decodes a GeoJSON geometry object to a Shape.
A GeoJSON object, as a JSON object.
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:
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.
featureCursor A Cursor
of Feature
s corresponding to the server response.
a Cursor
of LuciadRIA Feature
s which must be encoded to
the arbitrary representation
An object containing two properties:
content
: the encoded content as a String
. This is valid GeoJSONcontentType
: the mime type as a String
. It equals "application/json
"The encoded content as a String
The mime type describing how the content was encoded as a String
A GeoJsonCodec is responsible for 2 things:
decode a GeoJSON JavaScript object to a Feature.
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
Point
,Linestring
,Polygon
,MultiPoint
,MultiLinestring
,MultiPolygon
,GeometryCollection
. 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.Supported versions
LuciadRIA supports the full feature set of GeoJSON with the following limitations: