带缓冲区的WMS GetFeatureInfo请求不返回任何结果(OpenLayersMapServer)

问题描述 投票:1回答:1

我正在使用OpenLayers 4建立一个带有缓冲参数的GetFeatureInfo url到Mapserver中的一个WMS图层,以便在给定的一些特定坐标下找到该图层的最近特征。

问题是,这个请求根本就没有返回任何结果。所以我不知道是我的代码出了问题还是我遗漏了什么。

下面是我的代码解释。

var layer = new ol.layer.Image({
    source: new ol.source.ImageWMS({
        url: 'http://www.juntadeandalucia.es/medioambiente/mapwms/REDIAM_PPHH_2012?',
        params: {'LAYERS': 'MSPF_POLY'},
        serverType: 'mapserver',
        crossOrigin: 'anonymous'
    })
});

// I create the layer only for requesting purpose so I don't add it to the map.

var coordinates = [311618.514508171, 4040090.26715453];

var srs = this.map_.getProjection().code; //"EPSG:25830"

const getFeatureInfoParams = {
        'INFO_FORMAT': 'text/plain', //or application/vnd.ogc.gml
        'FEATURE_COUNT': 1,
        'SRS': srs,
        'Buffer': 10;
};

var viewResolution = this.map_.getMapImpl().getView().getResolution(); 
// 353.3212194629518

var urlToRequest = layer.getSource().getGetFeatureInfoUrl(coordinates, viewResolution, srs, 
getFeatureInfoParams);

return urlToRequest;
// urlToRequest is ==> http://www.juntadeandalucia.es/medioambiente/mapwms/REDIAM_PPHH_2012?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&FORMAT=image%2Fpng&TRANSPARENT=true&QUERY_LAYERS=MSPF_POLY&LAYERS=MSPF_POLY&INFO_FORMAT=text%2Fplain&FEATURE_COUNT=1&SRS=EPSG%3A25830&Buffer=10&I=50&J=50&CRS=EPSG%3A25830&STYLES=&WIDTH=101&HEIGHT=101&BBOX=293775.7929252919%2C4022247.5455716513%2C329461.2360910501%2C4057932.988737409

//I have seen that it always return I=50/J=50 and perhap this could be the problem I 
//don't know. It is that correct? The pixel coordinates shouldn't be different in 
//different bounding boxes values per request?
javascript gis openlayers wms mapserver
1个回答
0
投票

buffer 是不属于 WMS规格 并且不被MapServer通过WMS支持。您可以在以下网址阅读有关 MapServer 的 WMS 支持的更多信息。https:/mapserver.orgogcwms_server.html。 其他类型的映射服务器可能会提供缓冲区作为厂商特定的附加参数。

在MapServer方面,有其他的方法来处理缓冲区操作,但在你的情况下,似乎你是在客户端。

不好意思,在这个问题上帮了你这么一点忙。

© www.soinside.com 2019 - 2024. All rights reserved.