mark-p-thomas : GIS GeoJsonManager Class

Sections

The GeoJSON manager class is meant to handle various tasks associated with GeoJSON objects, such as validation, extraction of selective data, & conversion to types used within the library, such as Track objects.

Factory Methods

The GeoJSON manager is instantiated purely through factory methods as there are a variety of ways to instantiate one.

trackFromJson

This factory method creates a new GeoJSON manager object from a GeoJSON FeatureCollection wrapper object. If such an object was initialized with raw GeoJSON, then changes to the Track object will cascade to the original GeoJSON object.

Serialization

The GeoJSON manager object has a variety of methods for exporting its state for other uses. A common one is conversion to various data types used in the app, such as Track objects.

toTrack

The GeoJsonManager, once initialized with a wrapped GeoJSON object, can be called to attempt to generate a Track object. In order for this to work, the GeoJSON object is assumed to contain a Feature Collection with a single Feature (only the first is used). This Feature is assumed to contain either a LineString or a MultiLineString. Any violations of the assumptions results in null returned.

Track Gaps are managed here by merging LineStrings of any MultiLineString into a single LineString object.

Finally, the LineString is used to generate a Track object, which is returned. See ref: Track.fromJson for more details.