Skip to content

Instantly share code, notes, and snippets.

@iamgeoknight
Created September 12, 2021 12:51
Show Gist options
  • Save iamgeoknight/d66c62eef4ac20477a1f1b4658e5082e to your computer and use it in GitHub Desktop.
Save iamgeoknight/d66c62eef4ac20477a1f1b4658e5082e to your computer and use it in GitHub Desktop.
Creating a Map Click Event Listener
let map = new ol.Map({
target: map_div,
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
wmsLayer
],
view: new ol.View({
center: ol.proj.fromLonLat(center),
zoom: zoom
})
});
//Creating a Map Click Event Listener
map.on('singleclick', function (e) {
//Perform Task on click
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment