workshop ol cluster

by Francesco Boccacci

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.4/proj4.js"></script>
<script src="https://epsg.io/3003.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/css/ol.css">
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/build/ol.js"></script>
<body>
  <div id="map" class="map"></div>
</body>

CSS

html, body {
  height: 100%;
  width: 100%;
  margin: 0
}

#map {
  height: 100%;
  width: 100%;
}

JavaScript

var map = new ol.Map({
      layers: [
        new ol.layer.Tile({
          source: new ol.source.OSM()
        })
      ],
      target: 'map',
      view: new ol.View({
        center: [1253220.67184, 5430658.10783],
        zoom: 10
      })
    });

    var seeds = {
      "type": "FeatureCollection",
      "crs": {
        "type": "name",
        "properties": {
          "name": "urn:ogc:def:crs:EPSG::3857"
        }
      },
      "features": [{
        "type": "Feature",
        "properties": {
          "id": 0
        },
        "geometry": {
          "type": "Point",
          "coordinates": [1285633.0823047876, 5438366.8619631492]
        }
      }, {
        "type": "Feature",
        "properties": {
          "id": 1
        },
        "geometry": {
          "type": "Point",
          "coordinates": [1263081.2445396364, 5421782.7375592068]
        }
      }, {
        "type": "Feature",
        "properties": {
          "id": 2
        },
        "geometry": {
          "type": "Point",
          "coordinates": [1255507.7046010012, 5422374.3119415911]
        }
      }, {
        "type": "Feature",
        "properties": {
          "id": 3
        },
        "geometry": {
          "type": "Point",
          "coordinates": [1283102.6267211954, 5404827.6611737078]
        }
      }, {
        "type": "Feature",
        "properties": {
          "id": 4
        },
        "geometry": {
          "type": "Point",
          "coordinates": [1218705.9081681131, 5456712.4451680398]
        }
      }, {
        "type": "Feature",
        "properties": {
          "id": 5
        },
        "geometry": {
          "type": "Point",
          "coordinates": [1252466.0546455004, 5407962.9015037082]
        }
      }, {
        "type": "Feature",
        "properties": {
          "id": 6
        },
        "geometry": {
          "type": "Point",
          "coordinates": [1238353.6431157354, 5445772.6010855669]
        }
      }, {
        "type": "Feature",
...