MapBoxVectorLayer: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
()
(Blanked the page)
Tag: Blanking
 
Line 1: Line 1:
== About ==
Used for displaying maps from a tile map service, with default projection 'EPSG:3857'.
==Setup==


<source lang="ts">
interface IMapBoxVectorLayerInfo extends IBaseLayerInfo {
    LayerType: "MapBoxVectorLayer";
    /** MapBox style url, e.g. mapbox://styles/mapbox/light-v10 */
    StyleUrl: URL;
    /** Map box access token, connects request to an active map box account */
    AccessToken: string;
}
interface IMapBoxElevationLayerInfo extends IBaseLayerInfo {
    LayerType: "MapBoxElevationLayer";
    /** Map box access token, connects request to an active map box account */
    AccessToken: string;
}
</source>
=== Example ===
<source lang="ts">
include {Layers} from "@mariateleplan/map-core"
const elevationInfo: Layers.IMapBoxElevationLayerInfo =        {
            "Visible": false,
            "LayerType": "MapBoxElevationLayer",
            "Id": "elev_mb",
            "Name": "Mapbox elevation",
            "AccessToken": "YOUR_ACCESS_TOKEN",
            "ParentLayerId": "maps"
        }
const mapBoxVectorInfo: Layers.IMapBoxVectorLayerInfo = {
            "Visible": false,
            "LayerType": "MapBoxVectorLayer",
            "Id": "mapbox_light_v10",
            "Name": "Mapbox light",
            "StyleUrl": "mapbox://styles/mapbox/light-v10",
            "AccessToken": "YOUR_ACCESS_TOKEN",
            "ParentLayerId": "maps"
}
const layers: Layers.ILayersInfo = {
    Services:{},
    Layers:[new Layers.MapBoxElevationLayer(elevationInfo), new Layers.MapBoxVectorLayer(mapBoxVectorInfo)]
}
const props = { 
      "Zoom": 10,
      "Center": [1197567, 8380058],
      "Projection": 'EPSG:3857'
    }
const mapHtmlId = "map";
const maria = new MariaCore(props, mapHtmlId)
maria.SetupLayers(layers)
</source>
[[Category:Web]]

Latest revision as of 10:55, 3 May 2022