From f484cf3c23155ab0b31ab686f7f7ceb4e7186856 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 19 Apr 2017 15:41:21 +0200 Subject: 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 --- index.html | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); -- cgit v1.2.3