[OpenLayers-Users] Filters and OpenLayers.loadURL with vector-layers

Stephan Holl stephan.holl at intevation.de
Wed Dec 10 13:20:28 EST 2008


Hello all,

I am working with a Vector-Layer, which dynamically adds features to a
Query-Layer. The feature-selection is done with a form on the website,
which submits search-strings and I create a WFS-filter from the
search-strings. This works, if I only have one filter (PropertyIsLike).
Having another PropertyIsLike-Filter combined with an
And-operator OpenLayers does not get any results.

Using FireBug I can spot the URL OL sends, and throwing this URL into
the browser just gets me the results I am expecting.

Some Code:
var wfs_url =
"http://some-wfs-server/needed-param?Service=WFS&maxfeatures=40&Version=1.0.0";
var filter =
"%3CAnd%3E%3CPropertyIsLike%20wildCard='*'%20singleChar='.'%20escape='!'%3E%3CPropertyName%3E"+attribute+"%3C/PropertyName%3E%3CLiteral%3E"+value+"%3C/Literal%3E%3C/PropertyIsLike%3E";
var filter2 =
'%3CPropertyIsEqualTo%3E%3CPropertyName%3E'+attribute2+'%3C/PropertyName%3E%3CLiteral%3E'+value2+'%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/And%3E';
var wfsurl = wfs_url + '&REQUEST=getfeature&typename=' + typename +
'&Filter=%3CFilter%3E'+ filter + filter2 +'%3C/Filter%3E';
alert(wfsurl);
OpenLayers.loadURL(wfsurl,'',null,highlight_them);

The URL looks correct, it even works in the browser though.

I am a little confused why it works in the Browser or with curl, but
not within OL.

Perhaps someone can give me a hint how to concatenate more than one
filter-items into a WFS-query.

Using OLs Filter-Objects does not lead to any results though, therefor
I decided to manualy create the filter.

Best regards

	Stephan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081210/9dedb4eb/signature.bin


More information about the Users mailing list