MapBoxLayers: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== About == Used for displaying maps from a tile map service, with default projection 'EPSG:3857'. ==Setup== <source lang="ts"> interface IMapBoxVectorLayerInfo extends IBas...") Â |
(→â€) |
||
Line 1: | Line 1: | ||
== About == Â | == About == Â | ||
Used for displaying | Used for displaying MapBox layers, here both the MapBox vector layer and a MapBox elevation layer. | ||
 | |||
==Setup== | ==Setup== | ||
Revision as of 09:57, 3 May 2022
About
Used for displaying MapBox layers, here both the MapBox vector layer and a MapBox elevation layer.
Setup
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;
}
Example
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)