Skip to content

WMSLayer

Example

Example Source Code
vue
<template>
  <div style="height: 400px" class="vw-full vh-full">
    <mb-map :center="[-96.8005, 38.5111]" :zoom="3">
      <mb-wms-layer
        url="https://ahocevar.com/geoserver/wms"
        layers="topp:states"
        version="1.3.0"
        extra-params="CRS=EPSG:3857&TILED=true"
      />
    </mb-map>
  </div>
</template>

<script setup lang="ts">
// https://ahocevar.com/geoserver/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=&TRANSPARENT=true&LAYERS=topp%3Astates&TILED=true&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-7514065.628545966%2C5009377.085697312%2C-6261721.357121638%2C6261721.35712164
</script>

API

PROPS

NameDescriptionTypeDefault
idLayer ID. A unique identifier for the layer.string-
layersLayer name(s). Specifies the layer(s) to be retrieved from the WMS server. This is typically a comma-separated list of layer names as defined in the WMS capabilities document.string-
layer-styleLayer style. Specifies the style to be used for the requested layer(s). This corresponds to the styles defined in the WMS capabilities document. If not specified, the default style is used.string-
tile-sizeTile size in pixels. Specifies the width and height of the tiles. Typically 256 for standard tile services.number256
heightTile height in pixels. Specifies the height of the tiles. Usually the same as tile-size.number256
widthTile width in pixels. Specifies the width of the tiles. Usually the same as tile-size.number256
urlWMS server URL. The base URL of the WMS service endpoint. This URL is used to construct GetMap requests.string-
formatImage format of the tiles/map. Common values include image/png, image/jpeg, and image/gif.string'image/png'
maxzoomMaximum zoom level. The highest zoom level at which tiles/maps are available. This corresponds to the highest resolution.number22
minzoomMinimum zoom level. The lowest zoom level at which tiles/maps are available. This corresponds to the lowest resolution.number0
showVisibility of the layer. If true, the layer is displayed; if false, the layer is hidden.booleantrue
subdomainsSubdomains for the URL. This is used for load balancing by distributing requests across multiple subdomains. If provided, the URL will be templated with {s} where the subdomain should be inserted (e.g., http://{s}.example.com/wms). Can be a string or an array of strings.string / string[] / number[]-
transparentTransparency of the map/tiles. If true, the background of the map/tiles will be transparent. This is particularly useful for overlaying the WMS layer on other map layers.booleantrue
versionWMS version. Specifies the version of the WMS standard to use. Common values include 1.1.1 and 1.3.0.string'1.1.1'
srsSpatial Reference System (SRS). Specifies the coordinate reference system of the requested map/tiles. Common values include EPSG:3857 (Web Mercator) and EPSG:4326 (WGS 84).string'EPSG:3857'
extra-paramsExtra parameters to be added to the GetMap request URL. These are additional query parameters that can be used to customize the request. The value should be a URL query string (e.g., "TIME=2024-01-01&STYLES=style_name").string-

EVENTS

NameDescriptionParameters
createdInitialization complete event-

SLOTS

NameDescription

METHODS

NameDescriptionDefinition