I'm trying to make a search engine in OpenLayers 3 by GeoServer features and WFS.
To do this should I use a CQL filter?
This is my connection code if GeoServer mediates OL3 would you be so kind as to show me an example of CQL from OpenLayers.
vectorWFS = new ol.source.Vector({
loader: function(extent,resolution,projection){
$.ajax('http://localhost:8080/geoserver/wfs',{
type: 'GET',
data:{
service:'WFS',
version:'1.1.0',
request:'GetFeature',
typename:'Botanico:Urbana',
srsname:'EPSG:3857',
outputFormat:'text/javascript'
},
dataType:'jsonp',
jsonpCallback:'callback:loadFeatures',
jsonp:'format_options'
});
}
});
window.loadFeatures=function(response){
GeoJSON= new ol.format.GeoJSON();
vectorWFS.addFeatures(GeoJSON.readFeatures(response));
};
layerVector = new ol.layer.Vector({
source: vectorWFS,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(0,0,255,1.0)',
width: 2
})
})
});