JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css">
<script src="http://openlayers.org/en/v3.0.0/build/ol.js"></script>
<div id="map_canvas" class="map"></div>
CSS
.map {
width: 400px;
height: 400px;
}
JavaScript
data = new ol.source.Vector();
map = new ol.Map({
target: 'map_canvas',
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuest({ layer: 'sat' })
})
],
view: new ol.View({
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
});
// created for owl range of data
var coord = ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857');
var lonLat = new ol.geom.Point(coord);
var pointFeature = new ol.Feature({
geometry: lonLat,
weight: 120 // e.g. temperature
});
data.addFeature(pointFeature);
// create the layer
heatMapLayer = new ol.layer.Heatmap({
source: data,
radius: 20
});
// add to the map
map.addLayer(heatMapLayer);