2

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)?

  • I can't see from your code if you have both layers listed in INFO_LAYERS parameter in the GetFeatureInfo request that gets generated. – user30184 Mar 8 '18 at 14:19
  • all the data you see is on the INFO_LAYERS, and then there is the MAP_LAYER but it's just for the map. – Sebastiano Mar 8 '18 at 14:22
1

WMS getFeatureInfo sends a single XY coordinate. The receiving server could apply a buffer. For GeoServer, you can use the buffer vendor specific paramter

url = pmfeatlayer.getSource().getGetFeatureInfoUrl(coordinate, 
         viewResolution, 
         projection, 
         {'INFO_FORMAT': 'text/html','buffer':'10'}
      );
  • it seems that it doesn't work, I'm using MapServer, is possible to do something about it in MapServer? – Sebastiano Mar 8 '18 at 14:33
  • @Sebastiano It seems to be layer's TOLERANCE and TOLERANCEUNITS – JGH Mar 8 '18 at 14:45
  • I've already tried to increase the TOLERANCE in the MAP file but nothing changes, I'm able to have back the data even if I'm not on top of the data but I don't have more data, I have the same amount of data – Sebastiano Mar 8 '18 at 14:49
  • I also found some difference between the parameters sent to MapServer between OL2 and OL4 but some of them I don't know how they are created like FEATURE_COUNT:10 – Sebastiano Mar 8 '18 at 16:04
  • at the end I make it works with FEATURE_COUNT:10, buffer doesn't work. I'm still unable to understand how OL2 has inserted this parameter in the URL – Sebastiano Mar 12 '18 at 15:14
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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