Add a radius input to the heatmap-earthquakes example
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
|
||||||
<div class="span12">
|
<div class="span8">
|
||||||
<h4 id="title">Earthquakes heatmap</h4>
|
<h4 id="title">Earthquakes heatmap</h4>
|
||||||
<p id="shortdesc">Demonstrates the use of a heatmap layer.</p>
|
<p id="shortdesc">Demonstrates the use of a heatmap layer.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
@@ -40,8 +40,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="tags">heatmap, kml, vector, style</div>
|
<div id="tags">heatmap, kml, vector, style</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<form>
|
||||||
|
<label>radius size</label>
|
||||||
|
<input id="radius" type="range" min="1" max="50" step="1" value="5"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../resources/jquery.min.js" type="text/javascript"></script>
|
<script src="../resources/jquery.min.js" type="text/javascript"></script>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ goog.require('ol.layer.Tile');
|
|||||||
goog.require('ol.source.KML');
|
goog.require('ol.source.KML');
|
||||||
goog.require('ol.source.Stamen');
|
goog.require('ol.source.Stamen');
|
||||||
|
|
||||||
|
var radius = $('#radius');
|
||||||
|
|
||||||
var vector = new ol.layer.Heatmap({
|
var vector = new ol.layer.Heatmap({
|
||||||
source: new ol.source.KML({
|
source: new ol.source.KML({
|
||||||
@@ -12,7 +13,7 @@ var vector = new ol.layer.Heatmap({
|
|||||||
projection: 'EPSG:3857',
|
projection: 'EPSG:3857',
|
||||||
url: 'data/kml/2012_Earthquakes_Mag5.kml'
|
url: 'data/kml/2012_Earthquakes_Mag5.kml'
|
||||||
}),
|
}),
|
||||||
radius: 5
|
radius: parseInt(radius.val(), 10)
|
||||||
});
|
});
|
||||||
|
|
||||||
vector.getSource().on('addfeature', function(event) {
|
vector.getSource().on('addfeature', function(event) {
|
||||||
@@ -38,3 +39,8 @@ var map = new ol.Map({
|
|||||||
zoom: 2
|
zoom: 2
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
radius.on('input', function() {
|
||||||
|
vector.setRadius(parseInt(radius.val(), 10));
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user