diff options
| author | Teddy Wing | 2017-04-19 15:41:21 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-04-19 15:46:13 +0200 | 
| commit | f484cf3c23155ab0b31ab686f7f7ceb4e7186856 (patch) | |
| tree | 1f2c703cd2daf2bb63de04db0a43738c6c0913f8 /index.html | |
| parent | 8479ae44d738e1b2bf4be47f7c1a16e8888fc7b1 (diff) | |
| download | geo-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.html | 11 | 
1 files changed, 11 insertions, 0 deletions
| @@ -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> | 
