diff --git a/examples/geolocation.html b/examples/geolocation.html
index 03c1ffda36..9485fca5b2 100644
--- a/examples/geolocation.html
+++ b/examples/geolocation.html
@@ -46,11 +46,19 @@
Geolocation example
+
+
position accuracy :
+
altitude :
+
altitude accuracy :
+
heading :
+
speed :
+
Example of a geolocation map.
-
geolocation, openstreetmap
diff --git a/examples/geolocation.js b/examples/geolocation.js
index 5ce7510bf1..99b4fcfcdb 100644
--- a/examples/geolocation.js
+++ b/examples/geolocation.js
@@ -3,6 +3,7 @@ goog.require('ol.Map');
goog.require('ol.Overlay');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
+goog.require('ol.dom.Input');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OSM');
@@ -24,6 +25,17 @@ var map = new ol.Map({
var geolocation = new ol.Geolocation();
geolocation.bindTo('projection', map.getView());
+var track = new ol.dom.Input(document.getElementById('track'));
+track.bindTo('checked', geolocation, 'tracking');
+
+geolocation.on('change', function() {
+ $('#accuracy').text(geolocation.getAccuracy() + ' [m]');
+ $('#altitude').text(geolocation.getAltitude() + ' [m]');
+ $('#altitudeAccuracy').text(geolocation.getAltitudeAccuracy() + ' [m]');
+ $('#heading').text(geolocation.getHeading() + ' [rad]');
+ $('#speed').text(geolocation.getSpeed() + ' [m/s]');
+});
+
var marker = new ol.Overlay({
map: map,
element: /** @type {Element} */ ($('').addClass('icon-flag').get(0))
@@ -41,8 +53,3 @@ geolocation.on('error', function(error) {
info.innerHTML = error.message;
info.style.display = '';
});
-
-
-$('#locate').click(function() {
- geolocation.setTracking(true);
-});