I created a map that brings up a popup overlay on click, the JSFiddle is here. The only issue I have now is if I have two points in the same location it.

As you can see with the Birmingham point, when you click on the point it only brings up the value of the point written in last (on top), ideally I would like it to show the values of any points that are in this location?


1 Answer 1


Somehow, you have to create an offset between the markers to the user be able to click on each.

My suggestion is to listen pointermove event and show the markers separately. I was facing with this same issue and here is my solution.


So, based on comments. My idea is: create an array attribute of the features id at the same location. On click check this attr and then proceed the way you want.

var birmingham = new ol.Feature({
    geometry: new ol.geom.Point(ol.proj.fromLonLat([-1.900878, 52.483952])),
    name: 'Birmingham',
    address: 'Here Address',
    children: [2,3]

Your fiddle forked.

  • Thanks @Jonatas, this works as a nice work-around, however the solution I need has to bring through all of the attributes in one list. I have achieved this using a getElementByID command that then brings this into a table, but have not managed to convert this into an overlay yet. Jun 4, 2015 at 8:21
  • You question was: You have two points (markers) at the same location. How to show them individually? Am I right? So, step by step. Jun 4, 2015 at 9:43
  • yes sorry, i should have been more clear. When i click on that one specific location, no matter how many points are in that same place, I want it to list the details of that point in the one overlay. Not sure if this is any clearer? Thanks again. Jun 4, 2015 at 9:46
  • So, you want a single marker with all the details in it? Jun 4, 2015 at 9:55
  • Yes, one popup, that in the case of the JSFiddle example that I put at the start will list "Birmingham" and "Birmingham2" in the same popup as they are in the same place. Jun 4, 2015 at 9:56

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.