[OpenLayers-Dev] [OpenLayers-Users] Help to create FeatureId filter & OpenLayers.Filter.Logical.NOT

Eric Lemoine eric.lemoine at camptocamp.com
Sun Dec 13 08:38:31 EST 2009


On Thursday, December 10, 2009, Ivan Grcic <ivan.grcic at geofoto.hr> wrote:
> Hi devs,
>
> before opening ticket i want to confirm that im right about this issue
>
> Currently its not possible to make filter like this:
> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
> <And>
> <Not><ogc:FeatureId fid="Feature.1"/></Not>
> <Not><ogc:FeatureId fid="Feature.2"/></Not>
> </And>
> </Filter>
>
> I trace the source of it, in Format/Filter/v1.js writers&readers for
> AND,OR, NOT do not handle FeatureIds seperatly as root "Filter" does.
>
> line: 296
>
>             "Not": function(filter) {
>                 var node = this.createElementNSPlus("ogc:Not");
>                 var childFilter = filter.filters[0];
>                 this.writeNode(
>                     this.getFilterType(childFilter), childFilter, node
>                 );
>                 return node;
>             },
>
> That happens because FeatureId doesnt have type and getFilterType
> method throws "Filter writing not supported for rule type: undefined"
> if we try to encapsulate FeatureId with Logical.Not
>
> Its neccesary to check if filter is of FeatureId type and treat it
> differently, like the root Filter element does
>
>             "Not": function(filter) {
>                 var node = this.createElementNSPlus("ogc:Not");
>                 var childFilter = filter.filters[0];
>
>                 var sub = childFilter.CLASS_NAME.split(".").pop();
>                 if(sub === "FeatureId") {
>                     for(var i=0; i<childFilter.fids.length; ++i) {
>                         this.writeNode("FeatureId", childFilter.fids[i], node);
>                     }
>                 } else {
>                     this.writeNode(
>                         this.getFilterType(childFilter), childFilter, node
>                     );
>                 }
>                 return node;
>             }
>
> Please can anyone confirm this?

Hi. I don't know the specs but they allow FeatureID filters within NOT
filters then I agree there's a bug in the library. And I think the
problem exists for AND and OR as well, no?

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Dev mailing list