GenericMapLayer: Difference between revisions

From Maria GDK Wiki
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"> nterface IGenericMapLayerInfo extends IBaseL...")
 
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:


<source lang="ts">
<source lang="ts">
nterface IGenericMapLayerInfo extends IBaseLayerInfo {
interface IGenericMapLayerInfo extends IBaseLayerInfo {
     LayerType: "GenericMapLayer";
     LayerType: "GenericMapLayer";
     /** URL of tile map service provider, with {x}, {y} and {z} as parameters */
     /** URL of tile map service provider, with {x}, {y} and {z} as parameters */
Line 15: Line 15:
<source lang="ts">
<source lang="ts">
include {Layers} from "@mariateleplan/map-core"
include {Layers} from "@mariateleplan/map-core"
const genericMapLayer: Layers.IGenericMapLayerInfo = {
const genericMapLayerInfo: Layers.IGenericMapLayerInfo = {
             "Visible": false,
             "Visible": false,
             "LayerType": "GenericMapLayer",
             "LayerType": "GenericMapLayer",
Line 25: Line 25:
const layers: Layers.ILayersInfo = {
const layers: Layers.ILayersInfo = {
     Services:{},
     Services:{},
     Layers:[new Layers.GdkMapLayer(genericMapLayer);]
     Layers:[new Layers.GenericMapLayer(genericMapLayerInfo);]
}
}
const props = {   
const props = {   

Latest revision as of 09:36, 3 May 2022

About

Used for displaying maps from a tile map service, with default projection 'EPSG:3857'.

Setup

interface IGenericMapLayerInfo extends IBaseLayerInfo {
    LayerType: "GenericMapLayer";
    /** URL of tile map service provider, with {x}, {y} and {z} as parameters */
    url: URL;
}

Example

include {Layers} from "@mariateleplan/map-core"
const genericMapLayerInfo: Layers.IGenericMapLayerInfo = {
            "Visible": false,
            "LayerType": "GenericMapLayer",
            "Id": "xyz_generic_map",
            "url": "http://examplehoster/exapmleexample&x={x}&y={y}&z={z}",
            "ParentLayerId": "maps"
}

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