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.
Decodes the server response, which is valid GeoJSON, to a Cursor of Feature instances. This method delegates to GeoJsonCodec.decodeGeometryObject.
A Store instance, used by a LuciadRIA feature layer, uses this method on each Store.query invocation,
passing the 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
featureCursor a Cursor of Feature instances 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 geometry object, as a JSON object.
The spatial reference in which the geometry
is defined.
the corresponding LuciadRIA Shape.
Decodes an object, which is valid GeoJSON, to a Cursor of Feature instances. This method delegates to GeoJsonCodec.decodeGeometryObject.
a GeoJSON object
an object literal that contain the following optional properties:
The spatial reference in which the Feature instances are defined. If provided this reference supersedes the default reference of the GeoJSON data.
featureCursor A Cursor of Feature corresponding to the server response.
Encodes a Cursor of Feature instances into GeoJSON. This method delegates to GeoJsonCodec.encodeShape.
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 into a set of LuciadRIA Feature objects containing LuciadRIA geometries and properties.
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.Spatial reference
The reference for shape decoding process is determined in the following way and order:
crs
field. This reference is used if you don't specify it in step 1 or 2.Supported versions
LuciadRIA supports the full feature set of GeoJSON with the following limitations: