SLDSelect (OpenLayers) is selecting too much points

209 views Asked by At

I added a SLDSelect to my map where I have some WMS layers; the selection works but it consider a big area instead of only the point where I click, so if I click on a Point layer the control highlight all the points next to the one I clicked on.

Here is the code I used to create the control:

new OpenLayers.Control.SLDSelect(
    OpenLayers.Handler.Click,
    {
        layers: [ ] // I add layers dinamically
        , selectionSymbolizer: {
            'Polygon': {fillColor: '#00FF66', stroke: false},
            'Line': {strokeColor: '#00FF33', strokeWidth: 2},
            'Point': {graphicName: 'square', fillColor: '#00FF00', pointRadius: 5}
        }
    }
)

How can I specify a setting in order to reduce the area considered as selection when I click on the map?

Thank you bye stefano

1

There are 1 answers

0
Darkcylde On

I think the problem is you are not setting the display class. Try chaging to the code below to just select any object you click on.

new OpenLayers.Control.SLDSelect(
                    OpenLayers.Handler.Click,
                    {
                        displayClass: 'olControlSLDSelectPoint',
                        layers: [],
                        selectionSymbolizer: {
                           'Polygon': {fillColor: '#00FF66', stroke: false},
                           'Line': {strokeColor: '#00FF33', strokeWidth: 2},
                           'Point': {graphicName: 'square', fillColor: '#00FF00', pointRadius: 5}
                        }
                    }
                )