JSFiddle - React, Tailwind, and code Playground

by Lawrence Ross

HTML

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://openlayers.org/en/v4.6.5/build/ol.js"></script>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<div id="map" class="map"></div>

CSS

/* Always set the map height explicitly to define the size of the div
   * element that contains the map. */
      #map {
        height: 100%;
      }
  /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }

JavaScript

var rome = new ol.Feature({
        geometry: new ol.geom.Point(ol.proj.fromLonLat([12.5, 41.9]))
      });

      var london = new ol.Feature({
        geometry: new ol.geom.Point(ol.proj.fromLonLat([-0.12755, 51.507222]))
      });

      var madrid = new ol.Feature({
        geometry: new ol.geom.Point(ol.proj.fromLonLat([-3.683333, 40.4]))
      });

      rome.setStyle(new ol.style.Style({
        image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
          color: '#8959A8',
          crossOrigin: 'anonymous',
          src: 'https://openlayers.org/en/v4.6.5/examples/data/dot.png'
        }))
      }));

      london.setStyle(new ol.style.Style({
        image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
          color: '#4271AE',
          crossOrigin: 'anonymous',
          src: 'https://openlayers.org/en/v4.6.5/examples/data/dot.png'
        }))
      }));

      madrid.setStyle(new ol.style.Style({
        image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
          color: [113, 140, 0],
          crossOrigin: 'anonymous',
          src: 'https://openlayers.org/en/v4.6.5/examples/data/dot.png'
        }))
      }));


      var vectorSource = new ol.source.Vector({
        features: [rome, london, madrid]
      });



var lamarin = ol.proj.fromLonLat([29.1728363, 40.8950354]);
var view = new ol.View({
  center: lamarin,
  zoom: 15// 5
});

var vectorSource = new ol.source.Vector({});
var places = [
  [29.1728363, 40.8950354, 'https://openlayers.org/en/v4.6.5/examples/data/dot.png','#8959A8'],
  [29.1741285, 40.8960586, 'https://openlayers.org/en/v4.6.5/examples/data/dot.png','#4271AE'],
  [29.1733, 40.894, 'http://maps.google.com/mapfiles/ms/micons/blue.png',/* [113, 140, 0]*/],
];

var features = [];
for (var i = 0; i < places.length; i++) {
  var iconFeature = new ol.Feature({
    geometry: new ol.geom.Point(ol.proj.transform([places[i][0], places[i][1]], 'EPSG:4326', 'EPSG:3857')),
  });


/*...