mark-p-thomas : GIS Route Class

Sections

This class represents Routes used in many GIS operations.

Currently this class has not been created, but as the GIS library expands in uses and capabilities, one will be created analogous to the Track Class. Information on this page is still accurate, apart from the diagrams referring to ‘Track’ where is should have ‘Route’ displayed.

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 Route object from a GeoJSON FeatureCollection wrapper object. If such an object was initialized with raw GeoJSON, then changes to the Route object will cascade to the original GeoJSON object.

Serialization

The Route object has a variety of methods for exporting its state for other uses.

toJson

The Route 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 Route 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 Route Manager during Route modifications. However, it can also be called independently from the main Map.tsx React-Leaflet component. See GIS Route Managers & GIS.ly Route Managers for examples of where this method is called.

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

Route Calculations

The Route object holds a Polyline Data Structure (Route 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 Route object to perform work on.