TrackLayer

From Maria GDK Wiki
Revision as of 10:04, 3 May 2022 by Elu (talk | contribs) ()
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About

The Track Layer is used to display the track system in Maria GDK.

Setup

export interface ITrackLayerInfo extends IBaseLayerInfo {
    LayerType: "TrackLayer";
    /** Name of tracklist to recieve from track service */
    ListName: string;
    /** Track service URL */
    ServiceUrl: URL;
    SymbolPointServiceUrl: URL;
    /** Set default style Xml */
    StyleXml: UrlOrInlineData;
    /** Set default filter. If empty, none is chosen. */
    FilterXml?: UrlOrInlineData;
    /** Default symbol size in pixels */
    BaseSymbolSize?: number;
    /** Sets the update interval time in [ms] between new get requests for tracks*/
    UpdateIntervalMs?: number;
    /** When in this zoom range, use a simplified, high preformance track symbols */
    SimplifiedZoomRange?: [min: number, max: number];
}

Example

include {Layers} from "@mariateleplan/map-core"
const trackLayerInfo: Layers.ITrackLayerInfo = {
            "LayerType": "TrackLayer",
            "Id": "ais_tracks", // 
            "Name": "Tracks ais",
            "ListName": "ais.test",
            "SymbolPointServiceUrl": "http://servicehost:PORT/symbolpoint",
            "ServiceUrl": "http://servicehost:PORT/tracks",
            "StyleXml": {
                "Value": "./data/style/TrackStyleSet.xml", //expects a style xml at this location, an example of a style xml is found in the maria-map example project
                "Type": "url"
            },
            "UpdateInterval": 250,
            "SimplifiedZoomRange": [
                0,
                7
            ],
            "LogLevel": "debug"
        },

const layers: Layers.ILayersInfo = {
    Services:{},
    Layers:[new Layers.TrackLayer(trackLayerInfo);]
}
const props = {   
      "Zoom": 10,
      "Center": [1197567, 8380058],
      "Projection": 'EPSG:3857'
    }
const mapHtmlId = "map";
const maria = new MariaCore(props, mapHtmlId)
maria.SetupLayers(layers)