JSFiddle - React, Tailwind, and code Playground

by Igor Lilliputten

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.8.2/ol.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.8.2/ol.css">
<div class="row-fluid">
  <div class="span12">
    <div id="map" class="map"></div>
  </div>
</div>

JavaScript

var pointFeature = new ol.Feature(new ol.geom.Point([0, 0]));
var dragInteraction = new ol.interaction.Modify({
    features: new ol.Collection([pointFeature]),
    style: null
});

var map = new ol.Map({
  layers: [
    new ol.layer.Tile({
      source: new ol.source.TileJSON({
        url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
      })
    }),
    new ol.layer.Vector({
      source: new ol.source.Vector({
        features: [pointFeature]
      }),
      style: new ol.style.Style({
        image: new ol.style.Icon(({
          src: 'http://openlayers.org/en/v3.8.2/examples/data/icon.png'
        }))
      })
    })
  ],
  target: 'map',
  view: new ol.View({
    center: [0, 0],
    zoom: 2
  })
});
map.addInteraction(dragInteraction)

    debugger;
		pointFeature.on('change',function(){
    		    console.log('Feature Moved To:' + this.getGeometry().getCoordinates());
    		},pointFeature);