[OpenLayers-Users] Whitespace in Value Passed to Filter
Jerome A. Wendell
jawendell at suddenlink.net
Tue Apr 9 14:53:43 PDT 2013
I have a filter setup to be used on a WMS layer. The filtered features are
being placed on a vector layer. As long as the value that I pass to the
filter does not contain any whitespace, the filter works fine. If the value
passed to the filter contains whitespace within it, nothing is returned. I
am using Firefox with Firebug to test the map, and all of the values that
are passed to the filter are shown correctly in the POST command. I know
the features exist, on the layer that is being filtered, that have the
attribute with the value that I am using that has whitespace. Is there
anything that I can do to the filter so that the whitespace doesn't cause
the search to fail? The applicable part of my code is below:
var filter = new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: 'myproperty',
value: 'myvalue'
});
wfsProtocol = new OpenLayers.Protocol.WFS({
version: "1.1.0",
url: "http://myserver:8080/geoserver/mystore/wfs",
featureType: "mylayer", //name of the geoserver layer
featureNS: "mystore", //name of the geoserver store
geometryName: "the_geom",
srsName: "EPSG:4326",
scope: strategy
});
var strategy = new OpenLayers.Strategy.Fixed();
var response = wfsProtocol.read({
filter: filter,
callback: processWFSQuery
});
function processWFSQuery(response) {
try {
var gmlParser = new
OpenLayers.Format.GML.v3();
var features =
gmlParser.read(response.priv.responseXML);
vectorLayer.destroyFeatures();
if(features.length > 0) {
for(var i = 0; i <
features.length; i++) {
var feature
= features[i];
feature.geometry.transform(new
OpenLayers.Projection('EPSG:4326'),this.map.getProjectionObject());
vectorLayer.addFeatures(feature);
}
layextent = vectorLayer.getDataExtent();
map.zoomToExtent(layextent);
}else {
alert("Not found!");
if (popup){
popup.destroy();
}
}
} catch(e) {
alert("Error: " + e);
}
}
Any suggestions are greatly appreciated.
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130409/b348a542/attachment-0001.html>
More information about the Users
mailing list