Search code examples
javascriptopenlayers

OpenLayers 4 getGetFeatureInfoUrl and HitTollerance


I'm using this piece of code

map.on('singleclick', function(evt) {

...
url = pmfeatlayer.getSource().getGetFeatureInfoUrl(coordinate, viewResolution, projection, {'INFO_FORMAT': 'text/html'});

if (url) {...
}
...
}

And here my layer:

pmfeatlayer = new ol.layer.Tile({
  extent: ext,
  preload: Infinity,
  source: new ol.source.TileWMS({
    url: Settings.url,
    params: {'LAYERS': sQLayers, MYORDERS: Settings.order, DTO: DTo, format: 'image/png'},
    ratio: 1.1,
    gutter: 40
  })
});

to get the feature info on pmfeatlayer, Inside all the code I have also a function that displays a list of the feature in that pixel (If I have more than 1 URL create a list of them)

How can I increase the tolerance?

I found this example but I can't get it work, is this just for features or also for layers?

https://openlayers.org/en/latest/examples/hit-tolerance.html

Here a screenshot of my map.

enter image description here

I have a map layer and a featlayers (all the street restriction are on that layer) and as you can see from the popup at that pixel I have 2 restrictions, how can I increase the radius o get also the 2 street sign for example (because at the moment he display the 2 street line but not the signs)?


Solution

  • At the end I make it works with FEATURE_COUNT:10,buffer doesn't work.

    Checking the Request WMS URL I found FEATURE_COUNT:10, in another version of the project with others type of data, a parameter that is not present in the old code, I'm still unable to understand how OL2 has inserted this parameter in the URL