mark-p-thomas : GIS Track Class

Sections

This class represents Tracks used in many GIS operations.

Factory Methods

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

fromJson

This factory method creates a new Track 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 Track object has a variety of methods for exporting its state for other uses.

toJson

The Track object can write its state back to GeoJSON via the contained GeoJSON wrapper object. This is illustrated below.

Updating

Most of the querying & modifications occur only on the Polyline Track for the sake of efficiency. Because of this, the contained Polyline object will inevitably get out of sync with the contained GeoJSON wrapper object. Updating syncs these two objects on the relevant data.

updateGeoJsonTrack

This is often called within the Track Manager during Track modifications. However, it can also be called independently from the main Map.tsx React-Leaflet component. See GIS Track Managers & GIS.ly Track Managers for examples of where this method is called.

Not only does this synchronize the state of the GeoJSON Wrapper object stored within the Track object, but it also updates any raw GeoJSON object that may have been used to instantiate the Track object.

Track Calculations

The Track object holds a Polyline Data Structure (Track Polyline) & an associated GeoJSON object within a wrapper. The polyline acts as a proxy for the original track, where additional decorations of properties can be added to vertices, segments, including 2nd & 3rd order affects.

These objects & properties are also easily accessed & manipulated by manager objects that are given a Track object to perform work on.