Ol3 feature movement and hover
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.3.2/ol-debug.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.3.2/ol-debug.css">
<div id="map" style="width: 100%; height: 500px;">
</div>
<button id="save" style="position: fixed; bottom: 0px; right: 10px;">Save</button>
<button id="load" style="position: fixed; bottom: 25px; right: 10px;">Load</button>
JavaScript
var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([9, 44.65], 'EPSG:4326', 'EPSG:3857')),
name: 'Test',
description: 'Test',
id: '8f893ceb-9bb3-aba4-1459-549ab1c8e4df',
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAB9ElEQVQ4y42TXUhTARTHz/V6d9EoSWUotSQaUVgvUQhFQkEUBcsGI8M91ENGiFHRUx9E9FS0HqJCKCEECafsqYd6qGDLihpCYw9JiTEpIjPt3lktaL8errv7cHd1zuv5cc7/nP8RWRRGw8CltnF/2GzFJf8T02vXjAnCvqHvXpR/FFP1y+u7K1h55Bx1FcufVs9tjt7RMjlg2afXu1ArAF+a0qGAIWj0cx1B8IVNdwXg52pzaNVvN5PMkyZODS1T6d1ojoC5/tUjye4nTj8DjLMVPfP17DdnHXNbOt8KB8hpaEcIRWY8ziPtbJwVdBtwIbQnM61O9UqiQxC83CfFBLdpQlg+a2x3uAbKyCFBSDC/kMMIwgc/1fk7FQE3DgobMbmJnwARDGoRYsfQ7ZrCjV2sutIl7GAMZUFDimaEhyc/1tpAobvQrnUL23hhi35PA8Jw71RN2Q7v9FCP4OGl3eENCsLg4aSrbIe4dvmoIDwjRowoUe4hCIOBvJ9KNJzpFAQPoxhM0kcdkhXCvvxuSqx4Yo/8sYZRUW0lIx0FQPFFLrQJi/OJ3/GNrm4qByT2OnpptCU3Uj7rf6Q2OAJGozpRCqx7Pt3s/P5LVzwoBbpu4bbkFvnIis9L+nqDj4PJ7sxxTmdPmYFoMJI8P7PSWiiqCPpfS/dVCqqgCUAAAAAASUVORK5CYII=",
});
var source = new ol.source.Vector({
features: [iconFeature]
});
var clusterSource = new ol.source.Cluster({
source: source,
distance: 40
});
var clusters = new ol.layer.Vector({
source: clusterSource,
style: function(feature) {
var size = feature.get('features').length;
var myStyle = new ol.style.Style({
image: new ol.style.Circle({
radius: 8,
stroke: new ol.style.Stroke({
color: "rgba(255, 0, 255, 0.6)",
width: 2
}),
fill: new ol.style.Fill({
color: "rgba(255, 0, 255, 0.6)"
})
})
});
return myStyle;
}
});
clusters.title = "clusters";
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
raster.title = "raster";
var map = new ol.Map({
layers: [raster, clusters],
target: 'map',
loadTilesWhileAnimating: true,
loadTilesWhileInteracting: true,
view: new ol.View({
center: ol.proj.transform([9, 44.65], 'EPSG:4326', 'EPSG:3857'),
zoom: 8
...