OpenLayers 4 getGetFeatureInfoUrl 和 HitTollerance [英] OpenLayers 4 getGetFeatureInfoUrl and HitTollerance

查看:36
本文介绍了OpenLayers 4 getGetFeatureInfoUrl 和 HitTollerance的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这段代码

map.on('singleclick', function(evt) {...url = pmfeatlayer.getSource().getGetFeatureInfoUrl(coordinate, viewResolution,projection, {'INFO_FORMAT': 'text/html'});如果(网址){...}...}

这里是我的图层:

pmfeatlayer = new ol.layer.Tile({范围:分机,预加载:无限,来源:新 ol.source.TileWMS({网址:Settings.url,参数:{'LAYERS':sQLayers,MYORDERS:Settings.order,DTO:DTo,格式:'image/png'},比率:1.1,天沟:40})});

要获取 pmfeatlayer 上的功能信息,在所有代码中,我还有一个功能可以显示该像素中的功能列表(如果我有 1 个以上的 URL,请创建它们的列表)

如何增加容差?

我找到了这个例子,但我不能让它工作,这只是针对特征还是针对图层?

我有一个 map layer 和一个 featlayers(所有街道限制都在该图层上),正如您从该像素的弹出窗口中看到的,我有 2 个限制,例如,我怎样才能增加半径 o 获得 2 街道标志(因为此时他显示 2 街道线而不是标志)?

解决方案

最后我让它与 FEATURE_COUNT:10 一起工作,buffer 不起作用.

检查请求 WMS URL 我发现 FEATURE_COUNT:10,在另一个版本的项目中,其他类型的数据,旧代码中不存在的参数,我仍然无法了解OL2如何在URL中插入这个参数

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.

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

解决方案

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

这篇关于OpenLayers 4 getGetFeatureInfoUrl 和 HitTollerance的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆