Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using FeaturePopups control to show tooltips and popups for clusters. I have features connected (ends of road segments) with the same names. Is it possible to remove them from tooltips and popups, so to have a list with unique names?

Thank you, Bogdan

share|improve this question

It is necessary to rewrite the html list popup preparation using event "beforepopupdisplayed" on option popupListOptions.eventListeners as:

var fpControl = new OpenLayers.Control.FeaturePopups({        
  popupListOptions: {eventListeners: {
    "beforepopupdisplayed": function(e){
        var html = [],
            htmlAux = [];
        for (var i = 0, iLen = e.selection.length; i < iLen; i++) {
            var sel = e.selection[i],
                layerObj = sel.layerObj;                
            for (var ii = 0, iiLen = sel.features.length; ii < iiLen; ii++) {
                // ******** FILTER DUPLUCATES HERE ******************
                if (true) { 
                        layerObj.templates.item, sel.features[ii])
            layerObj.templates.list, {
                layer: sel.layer,
                count: sel.features.length,
                html: htmlAux.join('\n')
        e.html = html.join('\n');

For tooltips is a bit more simple, not much. It seems this way acceptable? If so, I will prepare a tested code for tooltips.

WARNING: To use this trick you should update the control, today it has made ​​a small adjustment.

share|improve this answer
It works but only for popups. It would be nice to have a solution for tooltips also. I just add this condition on your code: if (jQuery.inArray(sel.features[ii].attributes["name"], namesInPopup) == -1) { // ******** FILTER DUPLICATES HERE ****************** and the initialisation of namesInPopup array some lines before: var html = [], htmlAux = [], namesInPopup = []; – Bogdan Nov 22 '12 at 0:20
Jorix updated the control and set an extended example here:… Now the list of features from the cluster tooltip and popup is very simple to manage. This solved my problem. Thank you Jorix! – Bogdan Nov 23 '12 at 0:02

you can remove popups with some basic coding.

var allpps = map.popups;
for(var i=0; i < allpps.length; i++){
   if(allpps[i].id.indexOf('blabla') > -1){ // You write what you want to put here.

i hope it helps you...

share|improve this answer
Thank you Aragon! I don't need to remove popups, but links on the first popup which open other popups. You can see how it looks here: Just clicl on a big yellow circle. – Bogdan Nov 19 '12 at 23:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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