<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>VueLayers UMD</title>
<!-- include Vue -->
<script src="https://u...content-available-to-author-only...g.com/vue/dist/vue.js"></script>
<!-- include OpenLayers -->
<script src="https://u...content-available-to-author-only...g.com/openlayers/dist/ol.js"></script>
<!-- include UMD VueLayers build -->
<link rel="stylesheet" href="https://u...content-available-to-author-only...g.com/vuelayers/lib/style.css">
<script src="https://u...content-available-to-author-only...g.com/vuelayers/lib/index.umd.js"></script>
<style>
html, body, #app {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;
}
body * {
box-sizing: border-box;
}
</style>
</head>
<body>
<div id="app">
<div>
<vl-map :load-tiles-while-animating="true"
:load-tiles-while-interacting="true"
data-projection="EPSG:4326">
<vl-view :zoom="zoom"
:center="center"
:max-zoom="maxZoom"
:min-zoom="minZoom"
:rotation="rotation"></vl-view>
<vl-layer-tile>
<vl-source-xyz :url="'/map/{z}/{x}/{y}'"></vl-source-xyz>
</vl-layer-tile>
<vl-layer-vector>
<vl-source-vector>
<vl-feature v-for="f in features" :key="f.id">
<vl-geom-point :coordinates="f.geometry.coordinates"></vl-geom-point>
<vl-style-box>
<vl-style-text :text="_fommatText(f)"
font="bold 24px Arial"
text-align="end"
text-baseline="middle">
<vl-style-stroke :width="3"
color="rgba(250,0,0,0.8)"></vl-style-stroke>
<vl-style-fill :color="f.properties.color"></vl-style-fill>
</vl-style-text>
<vl-style-icon src="/Scripts/VueLayers/dot.png"
cross-origin="anonymous"
:color="f.properties.color"></vl-style-icon>
</vl-style-box>
</vl-feature>
</vl-source-vector>
</vl-layer-vector>
<vl-layer-vector>
<vl-source-vector ident="draw-target" ></vl-source-vector>
<vl-style-box>
<vl-style-text text=" how to bin text by data?"
font="bold 25px Arial"
text-align="end"
text-baseline="middle">
<vl-style-stroke color="red" :width="3"></vl-style-stroke>
<vl-style-fill color="yellow"></vl-style-fill>
</vl-style-text>
<vl-style-icon src="/Scripts/VueLayers/dot.png"
cross-origin="anonymous"
color="yellow"></vl-style-icon>
</vl-style-box>
</vl-layer-vector>
<vl-interaction-draw source="draw-target" type="Point"></vl-interaction-draw>
<vl-interaction-snap source="draw-target"></vl-interaction-snap>
<vl-interaction-modify source="draw-target"></vl-interaction-modify>
</vl-map>
</div>
<div>
<button @@click="test">test</button>
</div>
</div>
<script>
// all input/output coordinates, GeoJSON features in EPSG:4326 projection
Vue.use(VueLayers, {
dataProjection: 'EPSG:4326',
})
var app = new Vue({
el: '#app',
data: {
center: [37.41, 8.82],
rotation: 0,
zoom: 5,
maxZoom: 5,
minZoom: 5,
features: [
{
id: "d45bdba2-84b7-46d9-80a0-64b78c67acd1",
type: "Feature",
geometry: {
type: 'Point',
coordinates: [37.41, 15.82],
},
properties: {
name: "Point 1",
color: 'yellow',
value: 100,
},
},
{
id: "d45bdba2-84b7-46d9-80a0-64b78c67acd2",
type: "Feature",
geometry: {
type: 'Point',
coordinates: [30.41, 10.82],
},
properties: {
name: "Point 2",
color: 'yellow',
value: 50,
},
},
{
id: "d45bdba2-84b7-46d9-80a0-64b78c67acd3",
type: "Feature",
geometry: {
type: 'Point',
coordinates: [47.41, 15.82],
},
properties: {
name: "Point 3",
color: 'yellow',
value: 0,
},
},
],
},
methods: {
_fommatText(f) {
return ` ${f.properties.name}
${f.properties.value}%`;
},
test() {
setInterval(() => {
for (var i = 0; i < this.features.length; i++) {
let color = ["blue", "yellow", "green", "pink"][Math.ceil(Math.random() * 100) % 4];
let value = Math.ceil(Math.random() * 100);
this.features[i].properties.color = color;
this.features[i].properties.value = value;
}
}, 1000);
}
},
})
</script>
</body>
</html>
PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbG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KICAgIDwvc3R5bGU+CjwvaGVhZD4KPGJvZHk+CiAgICA8ZGl2IGlkPSJhcHAiPgogICAgICAgIDxkaXY+CiAgICAgICAgICAgIDx2bC1tYXAgOmxvYWQtdGlsZXMtd2hpbGUtYW5pbWF0aW5nPSJ0cnVlIgogICAgICAgICAgICAgICAgICAgIDpsb2FkLXRpbGVzLXdoaWxlLWludGVyYWN0aW5nPSJ0cnVlIgogICAgICAgICAgICAgICAgICAgIGRhdGEtcHJvamVjdGlvbj0iRVBTRzo0MzI2Ij4KICAgICAgICAgICAgICAgIDx2bC12aWV3IDp6b29tPSJ6b29tIgogICAgICAgICAgICAgICAgICAgICAgICAgOmNlbnRlcj0iY2VudGVyIgogICAgICAgICAgICAgICAgICAgICAgICAgOm1heC16b29tPSJtYXhab29tIgogICAgICAgICAgICAgICAgICAgICAgICAgOm1pbi16b29tPSJtaW5ab29tIgogICAgICAgICAgICAgICAgICAgICAgICAgOnJvdGF0aW9uPSJyb3RhdGlvbiI+PC92bC12aWV3PgoKICAgICAgICAgICAgICAgIDx2bC1sYXllci10aWxlPgogICAgICAgICAgICAgICAgICAgIDx2bC1zb3VyY2UteHl6IDp1cmw9IicvbWFwL3t6fS97eH0ve3l9JyI+PC92bC1zb3VyY2UteHl6PgogICAgICAgICAgICAgICAgPC92bC1sYXllci10aWxlPgoKICAgICAgICAgICAgICAgIDx2bC1sYXllci12ZWN0b3I+CiAgICAgICAgICAgICAgICAgICAgPHZsLXNvdXJjZS12ZWN0b3I+CiAgICAgICAgICAgICAgICAgICAgICAgIDx2bC1mZWF0dXJlIHYtZm9yPSJmIGluIGZlYXR1cmVzIiA6a2V5PSJmLmlkIj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx2bC1nZW9tLXBvaW50IDpjb29yZGluYXRlcz0iZi5nZW9tZXRyeS5jb29yZGluYXRlcyI+PC92bC1nZW9tLXBvaW50PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHZsLXN0eWxlLWJveD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dmwtc3R5bGUtdGV4dCA6dGV4dD0iX2ZvbW1hdFRleHQoZikiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9udD0iYm9sZCAyNHB4IEFyaWFsIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQtYWxpZ249ImVuZCIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0LWJhc2VsaW5lPSJtaWRkbGUiPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dmwtc3R5bGUtc3Ryb2tlIDp3aWR0aD0iMyIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvcj0icmdiYSgyNTAsMCwwLDAuOCkiPjwvdmwtc3R5bGUtc3Ryb2tlPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dmwtc3R5bGUtZmlsbCA6Y29sb3I9ImYucHJvcGVydGllcy5jb2xvciI+PC92bC1zdHlsZS1maWxsPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdmwtc3R5bGUtdGV4dD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dmwtc3R5bGUtaWNvbiBzcmM9Ii9TY3JpcHRzL1Z1ZUxheWVycy9kb3QucG5nIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyb3NzLW9yaWdpbj0iYW5vbnltb3VzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpjb2xvcj0iZi5wcm9wZXJ0aWVzLmNvbG9yIj48L3ZsLXN0eWxlLWljb24+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3ZsLXN0eWxlLWJveD4KICAgICAgICAgICAgICAgICAgICAgICAgPC92bC1mZWF0dXJlPgogICAgICAgICAgICAgICAgICAgIDwvdmwtc291cmNlLXZlY3Rvcj4KICAgICAgICAgICAgICAgIDwvdmwtbGF5ZXItdmVjdG9yPgoKICAgICAgICAgICAgICAgIDx2bC1sYXllci12ZWN0b3I+CiAgICAgICAgICAgICAgICAgICAgPHZsLXNvdXJjZS12ZWN0b3IgaWRlbnQ9ImRyYXctdGFyZ2V0IiA+PC92bC1zb3VyY2UtdmVjdG9yPgogICAgICAgICAgICAgICAgICAgIDx2bC1zdHlsZS1ib3g+CiAgICAgICAgICAgICAgICAgICAgICAgIDx2bC1zdHlsZS10ZXh0IHRleHQ9IiBob3cgdG8gYmluIHRleHQgYnkgZGF0YT8iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvbnQ9ImJvbGQgMjVweCBBcmlhbCIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dC1hbGlnbj0iZW5kIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0LWJhc2VsaW5lPSJtaWRkbGUiPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHZsLXN0eWxlLXN0cm9rZSBjb2xvcj0icmVkIiA6d2lkdGg9IjMiPjwvdmwtc3R5bGUtc3Ryb2tlPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHZsLXN0eWxlLWZpbGwgY29sb3I9InllbGxvdyI+PC92bC1zdHlsZS1maWxsPgogICAgICAgICAgICAgICAgICAgICAgICA8L3ZsLXN0eWxlLXRleHQ+CiAgICAgICAgICAgICAgICAgICAgICAgIDx2bC1zdHlsZS1pY29uIHNyYz0iL1NjcmlwdHMvVnVlTGF5ZXJzL2RvdC5wbmciCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyb3NzLW9yaWdpbj0iYW5vbnltb3VzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvcj0ieWVsbG93Ij48L3ZsLXN0eWxlLWljb24+CiAgICAgICAgICAgICAgICAgICAgPC92bC1zdHlsZS1ib3g+CiAgICAgICAgICAgICAgICA8L3ZsLWxheWVyLXZlY3Rvcj4KICAgICAgICAgICAgICAgIDx2bC1pbnRlcmFjdGlvbi1kcmF3IHNvdXJjZT0iZHJhdy10YXJnZXQiIHR5cGU9IlBvaW50Ij48L3ZsLWludGVyYWN0aW9uLWRyYXc+CiAgICAgICAgICAgICAgICA8dmwtaW50ZXJhY3Rpb24tc25hcCBzb3VyY2U9ImRyYXctdGFyZ2V0Ij48L3ZsLWludGVyYWN0aW9uLXNuYXA+CiAgICAgICAgICAgICAgICA8dmwtaW50ZXJhY3Rpb24tbW9kaWZ5IHNvdXJjZT0iZHJhdy10YXJnZXQiPjwvdmwtaW50ZXJhY3Rpb24tbW9kaWZ5PgoKICAgICAgICAgICAgPC92bC1tYXA+CiAgICAgICAgPC9kaXY+CiAgICAgICAgPGRpdj4KICAgICAgICAgICAgPGJ1dHRvbiBAQGNsaWNrPSJ0ZXN0Ij50ZXN0PC9idXR0b24+CiAgICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KCiAgICA8c2NyaXB0PgogICAgICAgIC8vIGFsbCBpbnB1dC9vdXRwdXQgY29vcmRpbmF0ZXMsIEdlb0pTT04gZmVhdHVyZXMgaW4gRVBTRzo0MzI2IHByb2plY3Rpb24KICAgICAgICBWdWUudXNlKFZ1ZUxheWVycywgewogICAgICAgICAgICBkYXRhUHJvamVjdGlvbjogJ0VQU0c6NDMyNicsCiAgICAgICAgfSkKCiAgICAgICAgdmFyIGFwcCA9IG5ldyBWdWUoewogICAgICAgICAgICBlbDogJyNhcHAnLAogICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICBjZW50ZXI6IFszNy40MSwgOC44Ml0sCiAgICAgICAgICAgICAgICByb3RhdGlvbjogMCwKICAgICAgICAgICAgICAgIHpvb206IDUsCiAgICAgICAgICAgICAgICBtYXhab29tOiA1LAogICAgICAgICAgICAgICAgbWluWm9vbTogNSwKICAgICAgICAgICAgICAgIGZlYXR1cmVzOiBbCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogImQ0NWJkYmEyLTg0YjctNDZkOS04MGEwLTY0Yjc4YzY3YWNkMSIsCiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICJGZWF0dXJlIiwKICAgICAgICAgICAgICAgICAgICAgICAgZ2VvbWV0cnk6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdQb2ludCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29yZGluYXRlczogWzM3LjQxLCAxNS44Ml0sCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICJQb2ludCAxIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yOiAneWVsbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAiZDQ1YmRiYTItODRiNy00NmQ5LTgwYTAtNjRiNzhjNjdhY2QyIiwKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogIkZlYXR1cmUiLAogICAgICAgICAgICAgICAgICAgICAgICBnZW9tZXRyeTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ1BvaW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb3JkaW5hdGVzOiBbMzAuNDEsIDEwLjgyXSwKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogIlBvaW50IDIiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3I6ICd5ZWxsb3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDUwLAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogImQ0NWJkYmEyLTg0YjctNDZkOS04MGEwLTY0Yjc4YzY3YWNkMyIsCiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICJGZWF0dXJlIiwKICAgICAgICAgICAgICAgICAgICAgICAgZ2VvbWV0cnk6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdQb2ludCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29yZGluYXRlczogWzQ3LjQxLCAxNS44Ml0sCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICJQb2ludCAzIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yOiAneWVsbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAwLAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICB9LAogICAgICAgICAgICBtZXRob2RzOiB7CiAgICAgICAgICAgICAgICBfZm9tbWF0VGV4dChmKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGAgICR7Zi5wcm9wZXJ0aWVzLm5hbWV9CiAgICAgICAke2YucHJvcGVydGllcy52YWx1ZX0lYDsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB0ZXN0KCkgewogICAgICAgICAgICAgICAgICAgIHNldEludGVydmFsKCgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0aGlzLmZlYXR1cmVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgY29sb3IgPSBbImJsdWUiLCAieWVsbG93IiwgImdyZWVuIiwgInBpbmsiXVtNYXRoLmNlaWwoTWF0aC5yYW5kb20oKSAqIDEwMCkgJSA0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB2YWx1ZSA9IE1hdGguY2VpbChNYXRoLnJhbmRvbSgpICogMTAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmVhdHVyZXNbaV0ucHJvcGVydGllcy5jb2xvciA9IGNvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5mZWF0dXJlc1tpXS5wcm9wZXJ0aWVzLnZhbHVlID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCAxMDAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICB9KQogICAgPC9zY3JpcHQ+CjwvYm9keT4KPC9odG1sPg==