[OpenLayers-Users] case insesitive openlayers filter not working

Spyros spirosmousouris at gmail.com
Tue Feb 11 14:14:06 PST 2014


I have the following filter in openlayers 2.13

var filter_c = new OpenLayers.Filter.Comparison({
    type: OpenLayers.Filter.Comparison.LIKE,
    property: 'strToLowerCase(p_name)',
    value: '%'+String(document.getElementById("nm").value).toLowerCase()+'%'
});

//pass the filter to the layer
var prot =  new OpenLayers.Protocol.WFS({
    url:  "/geoserver/wfs",
    featureType: "pins",
    featureNS: "http://www.mysite.gr",
    defaultFilter: filter_c
});

var _CallBack = function(resp) {
    pins.addFeatures(resp.features)
    var cb = pins.features.length;
    if (cb == 0){alert("Nothing Found");}
};

var response = prot.read({callback: _CallBack});


//refresh to render POIs
pins.refresh({force:true});
I also use Geoserver 2.1.3 and PostgreSQL 9.1 /PostGIS 2.0.

This filter is case sensitive. How can I make this filter case insensitive?

The pins layer takes data from a table in postgreSQL/PostGIS. Names are in
UTF8 and are Greek words, such as Ακρόπολη, Παρθενώνας etc.

I simply set it like pins = new OpenLayers.Layer.Vector("LayerTitle",
{renderers: ["Canvas", "SVG", "VML"]}) and the I have the aforementioned
code to search it.

When I use the filter I dont get the Nothing found alert, but I see no
points on the map and the map zooms 100% in the center. So, the filter kind
of works. What am I missing ?

Thanks



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/case-insesitive-openlayers-filter-not-working-tp5103260.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list