I'm developing a web mapping application using the Vuelayers
library which is Web map Vue components with the power of OpenLayers.
I have the following code in my template:
<vl-map @singleclick="hideOverlay" @postcompose="onMapPostCompose"
:load-tiles-while-animating="true" ref="map"
:load-tiles-while-interacting="true" data-projection="EPSG:4326"
style="height: 900px" @mounted="onMapMounted">
....
<component v-for="layer in layers" :ref="layer.id" overlay
:is="layer.cmp"
:key="layer.id" v-bind="layer">
<component :is="layer.source.cmp" v-if="layer.visible" v-bind="layer.source">
</component>
</component>
....
</vl-map>
And in the data object I have the following property:
layers: [
{
id: 'sections',
title: 'Sections',
cmp: 'vl-layer-tile',
visible: true,
source: {
cmp: 'vl-source-wms',
url: 'http://localhost:8080/geoserver/sager/wms',
layers: 'sections',
tiled: true,
format: 'image/png',
serverType: 'geoserver',
},
},
....
]
So how do I get the layer properties when I click on it? Knowing that vl-tile-layer
doesn't have the @click
event as mentioned here.