0
私は解決策を探していますが、答えが見つかりませんでした。私はDropdown list
からlayer
を取得し、cql-filter
の値を変更し、それが動作するようにupdate()
機能を使用して、私のレイヤーを表示するためのWFS
要求で働いていた最初の時点で:Openlayersを使用してcqlフィルタにupdate()関数を追加する3
<select name="pam" class='pam' id="pam" onchange='update()'>
<option value="Arbuuned">Moyen</option>
<option value="Bended">Fort</option>
</select>
<script>
var vector = new ol.layer.Vector({ source: new ol.source.Vector() })
var geojsonFormat = new ol.format.GeoJSON();
var vectorSource = new ol.source.Vector({
loader: function(extent, resolution, projection) {
var url = "http://localhost:8080/geoserver/opengeo/ows?service=WFS&" +
"version=2.0.0&request=GetFeature&typename=opengeo:arbousiers0&CQL_FILTER=code_espec="+"'"+pam.value+"'"+
"&outputFormat=text/javascript&format_options=callback:loadFeatures"+
"&srsname=EPSG:3857";
$.ajax({url: url, dataType: 'jsonp', jsonp: false});
},
strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({
maxZoom: 19
}))
});
window.loadFeatures = function(response) {
vectorSource.addFeatures(geojsonFormat.readFeatures(response));
};
window.update = function() {
vectorSource.clear(true);
};
</script>
しかし、私は変更WMS
要求で作業することを決定したとき、このようなスクリプト:私はdropdown list
から私のlayer
を選択したとき
var wmsSource= "code_espec="+"'"+pam.value+"'"+"";
window.update = function() {
wmsSource.clear(true);
};
new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://localhost:8080/geoserver/opengeo/wms',
params: {'LAYERS': 'opengeo:arbousiers0','cql_filter':wmsSource},
serverType: 'geoserver'
})})
は、私が何を取得します。私は追加する何かがあるか、私が作ったエラーがあるかどうかわからないのですか?ありがとうございます
ありがとう、ありがとう – Issam