Creates a GeoJSON codec. By default, a GeoJSON codec decodes 2D geometry, which means the z coordinates
of points (which usually contain height) are ignored. If the z coordinates must be encoded or decoded
as well, pass true to the mode3D property in the options object.
Represents the type of foreign (non-standard) members that are part of the GeoJSON.
The default is never, which means foreign members are not expected.
Optionaloptions: GeoJsonCodecConstructorOptions<TFeature, TForeignMembers>an object literal that contains configuration settings for the codec.
Decodes the server response, which is valid GeoJSON, into Feature instances. This method delegates to GeoJsonCodec.decodeGeometryObject.
A Store.query invocation, passing the options parameter containing the data to decode.
If the CodecDecodeOptions.reference option is present, the decoded features' shapes are encoded with this reference.
the decoding options
featureCursor of Feature instances corresponding to the server response.
Decodes a GeoJSON geometry string into a Shape or null.
The string representation of a GeoJSON geometry.
The spatial reference in which the geometry is defined.
The corresponding LuciadRIA Shape or null.
ProgrammingError If the input is not a valid GeoJSON geometry.
Decodes a GeoJSON geometry object into a Shape or null.
A GeoJSON geometry object, represented as a JSON object.
The spatial reference in which the geometry is defined.
The corresponding LuciadRIA Shape or null.
ProgrammingError If the input is not a valid GeoJSON geometry object.
Decodes a valid GeoJSON object into a Cursor.
a GeoJSON object to be decoded
Optionaloptions: DecodeObjectOptionsan options object literal
featureCursor A Cursor corresponding to the decoded GeoJSON object.
Encodes Feature instances into GeoJSON. This method delegates to GeoJsonCodec.encodeShape.
An object containing two properties:
content: A `string` containing the encoded GeoJSON content.contentType: The MIME type, always `application/json`.
A GeoJsonCodec is responsible for main tasks:
Encoding Feature instances into a JavaScript object that adheres to the GeoJSON specification The codec encodes the shape of the feature to GeoJSON geometries as follows:
Otherwise ShapeList is mapped based on its contents:
Decoding a GeoJSON JavaScript object into a set of LuciadRIA Feature instances, each containing corresponding LuciadRIA geometries and properties.
Since there's no direct mapping from a GeoJSON geometry to a LuciadRIA shape, the codec decodes GeoJSON geometries as follows:
nullgeometry translates into a Feature with a null shape.Note: According to the GeoJSON specification, the first and last position of a GeoJSON polygon must be equivalent. The codec removes this duplicate point when decoding the GeoJSON polygon to a LuciadRIA geometry.
Spatial reference
The reference used during the shape decoding process is determined in the following order:
crsfield. This will be used if no reference is provided in either of the first two steps.Limitations
GeoJSON does not support any other shapes than
Point,LineString,Polygon,MultiPoint,MultiLineString,MultiPolygon,GeometryCollection. Therefore, it cannot support all LuciadRIA shapes. For instance, a Circle cannot be directly represented as a circle in GeoJSON. Handling such shapes requires a custom codec, as demonstrated in the CreateEdit sample.