[OpenLayers-Users] Problem with multiple SelectFeature Controls within one map

John, Steffen s.john at atenekom.eu
Tue May 2 02:13:44 PDT 2017


Hi!

I'm using OpenLayers2 within Geoexplorer and Geonode. By default in Geonode, SelectFeatures controls are added for each layer in the map to request the getFeatureInfo.
In addition, I made an extension to Geonode, which also includes adding some SelectFeatures Controls to an additional draw layer.

Now I have the problem, that the SelectFeatures Controls from my extension are not working anymore, whenever a layer is loaded which has the SelectFeature Control for the GetFeatureInfo.

When the layer with the GetFeature Select Control is loaded after the extension, the extension works and not the getfeatureinfo in the layer.

To summerize, only the selectFeatureControl works, which is loaded first. I tried deactivating those GetFeatureInfo Select Controls, but this didn't help. There must be somehow a conflict between those.

Here ist the code of the selectcontrols from my extension:

   editSelectMultiple: new OpenLayers.Control.SelectFeature(
                    [drawLayer], {
                        clickout: true,
                        toggle: true,
                        multiple: false,
                        hover: false,
                        multipleKey: 'shiftKey',
                        toggleKey: 'ctrlKey',
                        multiple: true,
                        vertexRenderIntent: 'select',
                        box: true,
                        onSelect: function(feature) {
                            if (drawLayer.selectedFeatures.length == 1) {
                                if (!Ext.getCmp('measureWindow')){
                                    showMeasureWindow();
                                }
                               setMeasureWindowValues(null, feature);

                            } else {
                                closeMeasureWindow();
                            }

                        }
                    }
                ),
                hover: new OpenLayers.Control.SelectFeature(
                    [drawLayer], {
                        hover: true,
                        highlightOnly: true,
                        renderIntent: "temporary"
                    }
                ),

Does anyone has an idea of how to fix that?

Thanks in advance,
Steffen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20170502/cf68ef17/attachment.html>


More information about the Users mailing list