은 다음과 같은 것을 사용하여 기능 요청을받을 :
var url = myWMSLayer
.getSource()
.getGetFeatureInfoUrl(
evt.coordinate,
map.getView().getResolution(),
map.getView().getProjection(),
{
'INFO_FORMAT': 'application/json',
'propertyName': 'ATTR1,ATTR2,ATTR3'
}
);
이 전달 된 event.coordinate
내에 존재하는 당신에게 어떤 기능을 제공해야합니다. 따라서 주어진 포인트 내에 모든 피처가 되돌아 갈 수 있습니다. 서버에서 WMS 요청에 액세스 할 수있는 유일한 방법이라고 생각합니다.
그러나 서버가 WFS 요청을 지원하고 이에 대한 액세스 권한이 있으면 원하는 기능을 얻기 위해 wfs 요청을 실행할 수 있습니다. 다음과 같은 것 :
//here is the rectangle to search for fetaures
var extent [-8876804.07807116, 5368955.976007851, -8866790.827365803, 5374688.75312924];
$.ajax('http://demo.opengeo.org/geoserver/wfs', {
type: 'GET',
data: {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typename: 'mylayer',
srsname: 'EPSG:3857',
bbox: extent.join(',') + ',EPSG:3857'
}
}).done(function(resp){
//you may parse the responce back here
var formatWFS = new ol.format.WFS();
var feats = formatWFS.readFeatures(resp);
//now you can iterate through your features and get the attrs
for (var i=0;i<feats.length;i++){
console.log(feats[i].get('ATTR1'));
}
}).fail(function() {
alert("fail loading features");
});
'vectorSource' 변수가 Openlayer의'Map' 객체를 가리 킵니까? –