Creates an addition OGC expression. It takes two parameters, each one being an OGC expression.
Note that arithmetic operators are no longer supported in OGC Filter 2.0. You will get an error when you use them in OGC Filter 2.0 XML (for example WFS 2.0). You can still create them, evaluate them and use them in OGC Filter 1.1 XML though. FilterFactory.add(
FilterFactory.literal(12),
FilterFactory.property("age")
);
the first expression
the second expression
BinaryOperator
Creates a boolean AND condition. It represents a boolean AND evaluation of two other conditions.
FilterFactory.and(
FilterFactory.gt(
FilterFactory.property("TOT_POP"),
FilterFactory.literal(100000)
),
FilterFactory.lt(
FilterFactory.property("TOT_POP"),
FilterFactory.literal(500000)
)
);
the first condition
the second condition
any number of additional OGCCondition.
The And Logical Operator.
Create a bounding box expression.
FilterFactory.bbox(
createBounds( reference, coordinates ),
FilterFactory.property("geometry")
);
the bounds of the bounding box.
A Bbox operator
Create a bounding box expression.
FilterFactory.bbox(0, 0, 20, 40, "EPSG:4326");
x coordinate of the box's lower corner
y coordinate of the box's lower corner
x coordinate of the box's upper corner
y coordinate of the box's upper corner
A Bbox operator
Creates a Between expression. It evaluates to true
when the expression is
contained in the [lowerBounds
, upperBounds
] interval.
FilterFactory.between(
FilterFactory.property("total_population"),
FilterFactory.literal(10000),
FilterFactory.literal(20000)
);
FilterFactory.between(
FilterFactory.func( "getTotalPopulation" ),
FilterFactory.literal(10000),
FilterFactory.literal(20000)
);
the expression to evaluate
the lower bounds of the interval
the upper bounds of the interval
The Between expression
Creates a division OGC expression. It takes two parameters, each one being an OGC expression.
Note that arithmetic operators are no longer supported in OGC Filter 2.0. You will get an error when you use them in OGC Filter 2.0 XML (for example WFS 2.0). You can still create them, evaluate them and use them in OGC Filter 1.1 XML though. FilterFactory.div(
FilterFactory.property("population"),
FilterFactory.literal(1000)
);
the first expression
the second expression
BinaryOperator
Creates a condition that evaluates to true
when both expressions are equal.
FilterFactory.eq(
FilterFactory.property( "city_name" ),
FilterFactory.literal( "New York" )
);
FilterFactory.eq(
FilterFactory.func( "getCityNames" ),
FilterFactory.literal( "New York" ),
false,
MatchAction.ANY
);
the first expression
the second expression
A BinaryComparison of type "Equals".
Creates a custom OGC function with the given name and arguments.
FilterFactory.func(
"getCityName"
);
FilterFactory.func(
"geometryType",
FilterFactory.property( "geom" )
);
The name of a custom function
The arguments that should be passed to the function. This can be any number of OGCExpression.
The custom OGC function
Creates a condition that evaluates to true
when the first expression is greater than the second
expression.
Examples:
FilterFactory.gt(
FilterFactory.property("total_population"),
FilterFactory.literal(10000)
);
FilterFactory.gt(
FilterFactory.func("getTotalPopulation"),
FilterFactory.literal(10000)
);
the first expression
the second expression
A BinaryComparison of type "GreaterThan".
Creates a condition that evaluates to true
when the first expression is greater than or equal to the second
expression.
Examples:
FilterFactory.gte(
FilterFactory.property("total_population"),
FilterFactory.literal(10000)
);
FilterFactory.gte(
FilterFactory.func("getTotalPopulation"),
FilterFactory.literal(10000)
);
the first expression
the second expression
A BinaryComparison of type "GreaterThanOrEqual".
Creates an ID filter, which limits a result set to just the features whose ids match the ids represented by the ID filter.
An arbitrary number of IDs can be passed to the identifier method.
identifiers( [3, 5, "seven"] );
An array containing id values: ResourceId values (OGC Filter ver. 2.0), or GmlObjectId values (OGC Filter ver. 1.0)
An array containing FeatureId values (OGC Filter ver. 1.0 only).
The ID filter
Creates an "is null" expression. It evaluates to true if the value of the expression is null.
FilterFactory.isNull( FilterFactory.property( "city_name" ) );
FilterFactory.isNull( FilterFactory.func( "getCityName" ) );
the expression to evaluate
the isNull expression
Creates an "is like" expression which evaluates to true
when the value of expression
matches the specified pattern. It is possible to not specify the wildCard
, singleChar
and
escapeChar
arguments. In that case the OGC default values will be used (wildCard: '*', single char: '.' and
escapeChar character: '!').
FilterFactory.like(
FilterFactory.property('city_name'),
FilterFactory.literal('New*')
)
the propertyName to check
the pattern to match
The "is like" expression.
Creates a Literal
instance for value
.
The value used for the Literal
instance
The Literal
instance for value
Creates a condition that evaluates to true
when the first expression is lesser than the second
expression.
Examples:
FilterFactory.lt(
FilterFactory.property("total_population"),
FilterFactory.literal(10000)
);
FilterFactory.lt(
FilterFactory.func("getTotalPopulation"),
FilterFactory.literal(10000)
);
the first expression
the second expression
A BinaryComparison of type "LessThan".
Creates a condition that evaluates to true
when the first expression is lesser than or equal to the second
expression.
FilterFactory.lte(
FilterFactory.property("total_population"),
FilterFactory.literal(10000)
);
FilterFactory.lte(
FilterFactory.func("getTotalPopulation"),
FilterFactory.literal(10000)
);
the first expression
the second expression
A BinaryComparison of type "LessThanOrEqual".
Creates a multiplication OGC expression. It takes two parameters, each one being an OGC expression.
Note that arithmetic operators are no longer supported in OGC Filter 2.0. You will get an error when you use them in OGC Filter 2.0 XML (for example WFS 2.0). You can still create them, evaluate them and use them in OGC Filter 1.1 XML though. FilterFactory.mul(
FilterFactory.property("population"),
FilterFactory.literal(1000)
);
the first expression
the second expression
BinaryOperator
Creates a condition that evaluates to true
when both expressions are not equal.
FilterFactory.neq(
FilterFactory.property( "city_name" ),
FilterFactory.literal( "New York" )
);
FilterFactory.neq(
FilterFactory.func( "getCityName" ),
FilterFactory.literal( "New York" )
);
the first expression
the second expression
A BinaryComparison of type "NotEquals".
Creates a boolean NOT expression. It represents the negation of the expression.
FilterFactory.not(
FilterFactory.eq(
FilterFactory.property("city_name"),
FilterFactory.literal("New York")
)
);
the expression to negate.
The Not expression.
Creates a boolean OR expression. It represents a boolean OR evaluation of other expressions. It takes any number of parameters, each one being an expression.
FilterFactory.or(
FilterFactory.lt(
FilterFactory.property("TOT_POP"),
FilterFactory.literal(500000)
),
FilterFactory.eq(
FilterFactory.property("city_name"),
FilterFactory.literal("New York")
);
);
the first expression
the second expression
any number of additional Expression.
The Or expression.
Creates a value reference (OGC Filter version 2.0) or a property name (OGC Filter version 1.0) that represents a value that is to be evaluated by a filter predicate.
At runtime, a predicate is evaluated by replacing the value reference (property name) by the value it refers to.
the property name (or path) of a feature
The property instance for the propertyName
Creates a subtraction OGC expression. It takes two parameters, each one being an OGC expression.
Note that arithmetic operators are no longer supported in OGC Filter 2.0. You will get an error when you use them in OGC Filter 2.0 XML (for example WFS 2.0). You can still create them, evaluate them and use them in OGC Filter 1.1 XML though. FilterFactory.sub(
FilterFactory.property("age")
FilterFactory.literal(18),
);
the first expression
the second expression
BinaryOperator
Converts a feature into a javascript feature filter function, that can be used to filter features on the client side.
The returned function takes a single argument, a Feature. It returns true
when
the argument satisfies the condition. It returns false
when the argument does not satisfy the condition.
The condition may not contain function expressions.
var filter = FilterFactory.gte(
FilterFactory.property("total_population"),
FilterFactory.literal(10000)
);
aFeatureLayer.filter = FilterFactory.toFeaturePredicate( filter );
the condition to convert.
A predicate function.
A module with static functions to create Expression instances or Identifiers instances.
This class can for example be used in combination with a
WFSFeatureStore
. It allows to create a filter which is interpreted by the WFS server as shown below:var geoReference = ...; var wfsStore = new WFSFeatureStore({ serviceURL: "http://localhost:8080/LuciadLightspeedOGC/wfs", typeName: "rivers", reference: geoReference } ); var wfsModel = new FeatureModel(wfsStore, {reference: geoReference} ); var ogcFilter = FilterFactory.eq( FilterFactory.property("SYSTEM"), FilterFactory.literal("Mississippi")); var wfsLayer = new FeatureLayer(wfsModel, { label: "WFS Layer", selectable: true, loadingStrategy: new LoadEverything( {query: {filter: ogcFilter}} ) });