|
| 1 | +# ol-source-tile-wms |
| 2 | + |
| 3 | +Source for WMS servers providing tiled images. |
| 4 | + |
| 5 | +<script setup> |
| 6 | +import TileWMSDemo from "@demos/TileWMSDemo.vue" |
| 7 | +</script> |
| 8 | + |
| 9 | +<ClientOnly> |
| 10 | +<TileWMSDemo /> |
| 11 | +</ClientOnly> |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +```vue |
| 16 | +<template> |
| 17 | + <ol-map |
| 18 | + :loadTilesWhileAnimating="true" |
| 19 | + :loadTilesWhileInteracting="true" |
| 20 | + style="height: 400px" |
| 21 | + > |
| 22 | + <ol-view |
| 23 | + ref="view" |
| 24 | + :center="center" |
| 25 | + :rotation="rotation" |
| 26 | + :zoom="zoom" |
| 27 | + :projection="projection" |
| 28 | + /> |
| 29 | + <ol-zoom-control /> |
| 30 | +
|
| 31 | + <ol-tile-layer :zIndex="1000"> |
| 32 | + <ol-source-osm /> |
| 33 | + </ol-tile-layer> |
| 34 | +
|
| 35 | + <ol-tile-layer :zIndex="1001"> |
| 36 | + <ol-source-tile-wms |
| 37 | + url="https://ahocevar.com/geoserver/wms" |
| 38 | + :extent="[-13884991, 2870341, -7455066, 6338219]" |
| 39 | + layers="topp:states" |
| 40 | + serverType="geoserver" |
| 41 | + :transition="0" |
| 42 | + /> |
| 43 | + </ol-tile-layer> |
| 44 | + </ol-map> |
| 45 | +</template> |
| 46 | +
|
| 47 | +<script> |
| 48 | +import { ref } from "vue"; |
| 49 | +
|
| 50 | +export default { |
| 51 | + setup() { |
| 52 | + const zoom = ref(4); |
| 53 | + const rotation = ref(0); |
| 54 | + const center = ref([-10997148, 4569099]); |
| 55 | +
|
| 56 | + return { |
| 57 | + center, |
| 58 | + zoom, |
| 59 | + rotation, |
| 60 | + }; |
| 61 | + }, |
| 62 | +}; |
| 63 | +</script> |
| 64 | +``` |
| 65 | + |
| 66 | +## Properties |
| 67 | + |
| 68 | +# attributions |
| 69 | + |
| 70 | +- **Type**: `string` |
| 71 | + |
| 72 | +Attributions |
| 73 | + |
| 74 | +# cacheSize |
| 75 | + |
| 76 | +- **Type**: `Number` |
| 77 | + |
| 78 | +# crossOrigin |
| 79 | + |
| 80 | +- **Type**: `string` |
| 81 | +- **Default**: `ol-layer` |
| 82 | + |
| 83 | +The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer. |
| 84 | + |
| 85 | +# interpolate |
| 86 | + |
| 87 | +- **Type**: `Boolean` |
| 88 | +- **Default**: `true` |
| 89 | + |
| 90 | +# styles |
| 91 | + |
| 92 | +- **Type**: `[String,Array]` |
| 93 | + |
| 94 | +# layers |
| 95 | + |
| 96 | +- **Type**: `[String,Array]` |
| 97 | + |
| 98 | +# hidpi |
| 99 | + |
| 100 | +- **Type**: `Boolean` |
| 101 | +- **Default**: `true` |
| 102 | + |
| 103 | +# projection |
| 104 | + |
| 105 | +- **Type**: `string` |
| 106 | +- **Default**: `EPSG:3857` |
| 107 | + |
| 108 | +# reprojectionErrorThreshold |
| 109 | + |
| 110 | +- **Type**: `number ` |
| 111 | +- **Default**: 0.5 |
| 112 | + |
| 113 | +Maximum allowed reprojection error (in pixels). Higher values can increase reprojection performance, but decrease precision. |
| 114 | + |
| 115 | +# tileGrid |
| 116 | + |
| 117 | +- **Type**: `TileGrid|undefined` |
| 118 | +- **Default**: 0.5 |
| 119 | + |
| 120 | +Tile grid. Base this on the resolutions, tilesize and extent supported by the server. If this is not defined, a default grid will be used: if there is a projection extent, the grid will be based on that; if not, a grid based on a global extent with origin at 0,0 will be used. |
| 121 | + |
| 122 | +# serverType |
| 123 | + |
| 124 | +- **Type**: `string` |
| 125 | + |
| 126 | +The type of the remote WMS server: mapserver, geoserver or qgis. Only needed if hidpi is true. |
| 127 | + |
| 128 | +# tileLoadFunction |
| 129 | + |
| 130 | +- **Type**: `Function` |
| 131 | + |
| 132 | +# url |
| 133 | + |
| 134 | +- **Type**: `string` |
| 135 | + |
| 136 | +WMS service URL. |
| 137 | + |
| 138 | +# urls |
| 139 | + |
| 140 | +- **Type**: `Array.<string>` |
| 141 | + |
| 142 | +An array of URLs. Requests will be distributed among the URLs in this array. |
| 143 | + |
| 144 | +# params |
| 145 | + |
| 146 | +- **Type**: `Object.<string, *>` |
| 147 | + |
| 148 | +WMS request parameters. |
| 149 | + |
| 150 | +# wrapX |
| 151 | + |
| 152 | +- **Type**: `Boolean` |
| 153 | +- **Default**: `false` |
| 154 | + |
| 155 | +# transition |
| 156 | + |
| 157 | +- **Type**: `number` |
| 158 | +- **Default**: 250 |
| 159 | + Duration of the opacity transition for rendering. To disable the opacity transition, pass transition: 0. |
0 commit comments