I am working with web map application Lizmap which unfortunately is working with OpenLayers 2.

I want to trigger map click programically on specific position:

let event = new Event("click");
event.xy = {x: 400, y: 400};      // sample values
map.events.triggerEvent("click", event);    // map - OpenLayers map object

Everything works ok until I move map. After map move this doesn't work. I cannot trigger map click that way anymore and I have no idea why. I tried to debug OpenLayers to find out what's going on but I'm really stuck at this point.

I found this problem, but its not completed:

How to trigger a map click event?

1 Answer 1


Try to look for a different event triggering method here.

  • 1
    Link-only answers are often deleted, because links fail over time. Please Edit your answer to contain the meat of the linked content.
    – Vince
    May 16, 2022 at 12:39
  • I tried different methods, but didn't find anything helpful. May 16, 2022 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.