aboutsummaryrefslogtreecommitdiffstats
path: root/index.html
diff options
context:
space:
mode:
authorTeddy Wing2017-04-19 15:41:21 +0200
committerTeddy Wing2017-04-19 15:46:13 +0200
commitf484cf3c23155ab0b31ab686f7f7ceb4e7186856 (patch)
tree1f2c703cd2daf2bb63de04db0a43738c6c0913f8 /index.html
parent8479ae44d738e1b2bf4be47f7c1a16e8888fc7b1 (diff)
downloadgeo-feature-examiner-f484cf3c23155ab0b31ab686f7f7ceb4e7186856.tar.bz2
index.html: Add feature selection
Clicking on a geographical feature highlights it. Based on this OpenLayers example: http://openlayers.org/en/latest/examples/select-features.html
Diffstat (limited to 'index.html')
-rw-r--r--index.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/index.html b/index.html
index a5b9696..3ef1da3 100644
--- a/index.html
+++ b/index.html
@@ -40,6 +40,17 @@
zoom: 16
})
});
+
+ var select_click = new ol.interaction.Select({
+ condition: ol.events.condition.click
+ });
+ select_click.on('select', function(e) {
+ if (e.selected.length) {
+ var feature = e.selected[0];
+ }
+ });
+
+ map.addInteraction(select_click);
</script>
</body>
</html>