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
Name | Description | Type | Default |
---|---|---|---|
id | Layer ID. A unique identifier for the layer. | string | - |
layers | Layer 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-style | Layer 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-size | Tile size in pixels. Specifies the width and height of the tiles. Typically 256 for standard tile services. | number | 256 |
height | Tile height in pixels. Specifies the height of the tiles. Usually the same as tile-size . | number | 256 |
width | Tile width in pixels. Specifies the width of the tiles. Usually the same as tile-size . | number | 256 |
url | WMS server URL. The base URL of the WMS service endpoint. This URL is used to construct GetMap requests. | string | - |
format | Image format of the tiles/map. Common values include image/png , image/jpeg , and image/gif . | string | 'image/png' |
maxzoom | Maximum zoom level. The highest zoom level at which tiles/maps are available. This corresponds to the highest resolution. | number | 22 |
minzoom | Minimum zoom level. The lowest zoom level at which tiles/maps are available. This corresponds to the lowest resolution. | number | 0 |
show | Visibility of the layer. If true , the layer is displayed; if false , the layer is hidden. | boolean | true |
subdomains | Subdomains 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[] | - |
transparent | Transparency 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. | boolean | true |
version | WMS version. Specifies the version of the WMS standard to use. Common values include 1.1.1 and 1.3.0 . | string | '1.1.1' |
srs | Spatial 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-params | Extra 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
Name | Description | Parameters |
---|---|---|
created | Initialization complete event | - |
SLOTS
Name | Description |
---|
METHODS
Name | Description | Definition |
---|