SVG icon
by Vladimir Vershinin
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js"></script>
<script src="https://unpkg.com/[email protected]/lib/index.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/lib/style.css">
<div id="app">
<vl-map ref="map" data-projection="EPSG:4326">
<vl-view :zoom.sync="zoom" :center.sync="center"></vl-view>
<vl-layer-tile>
<vl-source-osm></vl-source-osm>
</vl-layer-tile>
<vl-layer-vector :update-while-animating="true" :update-while-interacting="true">
<vl-source-vector :features="features"></vl-source-vector>
<vl-style-box>
<vl-style-icon src="http://simpleicon.com/wp-content/uploads/rocket.svg" :scale="0.1"></vl-style-icon>
</vl-style-box>
</vl-layer-vector>
</vl-map>
</div>
CSS
html, body, #app {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
JavaScript
new Vue({
el: '#app',
data () {
return {
zoom: 2,
center: [0, 0],
features: [
{
"type": "Feature",
"id": 1,
"geometry": {
"type": "Point",
"coordinates": [10, 10],
},
},
{
"type": "Feature",
"id": 2,
"geometry": {
"type": "Point",
"coordinates": [20, 20],
},
},
{
"type": "Feature",
"id": 3,
"geometry": {
"type": "Point",
"coordinates": [-10, -10],
},
},
{
"type": "Feature",
"id": 4,
"geometry": {
"type": "Point",
"coordinates": [-20, 20],
},
},
{
"type": "Feature",
"id": 5,
"geometry": {
"type": "Point",
"coordinates": [20, -20],
},
},
{
"type": "Feature",
"id": 6,
"geometry": {
"type": "Point",
"coordinates": [-20, -20],
},
},
],
}
},
})