I'm using getGetFeatureInfoUrl to retrieve features from a WMS layer like that:

var url = wmsSource.getGetFeatureInfoUrl(
  evt.coordinate, viewResolution, 'EPSG:3857',
  {'INFO_FORMAT': 'text/xml'}

I have the problem that the features are quite small and so it's difficult to select a feature.

Is there any workaround to add something like hitTolerance in ol.interaction.Select? Or do I have to calculate manually an area and send a getGetFeatureInfoUrl request for every coordinate in this area?


If the server that you access happens to be GeoServer you can try to add a "buffer" parameter into your GetFeatureInfo request as documented in http://docs.geoserver.org/latest/en/user/services/wms/vendor.html. Otherwise you can't alter the tolerance because it is a server side setting.

GetFeatureInfo request itself does not have any tolerance because it sends the exact x and y values of the clicked pixel. What happens on the server side depends on the server, some more info in mailing list thread http://osgeo-org.1560.x6.nabble.com/GetFeatureInfo-Buffer-tolerance-default-td5071320.html.

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.