WmsMapLayer

From Maria GDK Wiki
Jump to navigation Jump to search

About

Used for displaying maps from a WMS service.

Setup

export interface IWmsMapLayerInfo extends IBaseLayerInfo {
    LayerType: "WmsMapLayer";
    /** URL to WMS tile provider */
    WmsUrl: URL;
    /** WMS Layers, */
    Layers?: string;
    /** Projection used, default is WPSG:4326 */
    Projection?: string;
}

Example

include {Layers} from "@mariateleplan/map-core"
const wmsLayerInfo: Layers.IWmsMapLayerInfo = {
            "Visible": false,
            "LayerType": "WmsMapLayer",
            "Id": "wms_test",
            "Name": "WMS Raster",
            "WmsUrl": "https://ahocevar.com/geoserver/wms",
            "Layers": "ne:NE1_HR_LC_SR_W_DR",
            "ParentLayerId": "maps"
}

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