class Filter extends java.lang.Object
A Filter is a predicate or constraint used to match or filter Feature objects.
You can create Filters from CQL:
Filter f = new Filter("name='foobar')
Or you can create Filters from XML:
Filter f = new Filter('<Filter><PropertyIsEqualTo><PropertyName>name</PropertyName><Literal>foobar</Literal></PropertyIsEqualTo></Filter>')
| Type Params | Return Type | Name and description |
|---|---|---|
|
Filter |
and(java.lang.Object other)Combine the current Filter with another Filter. |
|
static Filter |
bbox(java.lang.String fieldName, Bounds bounds)Create a Spatial Bounding Box Filter |
|
static Filter |
contains(java.lang.String fieldName, Geometry geometry)Create a Spatial Filter that contains the given Geometry |
|
static Filter |
crosses(java.lang.String fieldName, Geometry geometry)Create a Spatial Filter that crosses the given Geometry |
|
static Filter |
dwithin(java.lang.String fieldName, Geometry geometry, double distance, java.lang.String units)Create a Spatial Filter that is within a certain distance of the given Geometry. |
|
boolean |
equals(java.lang.Object obj)Does this Filter equal another Filter? |
|
static Filter |
equals(java.lang.String field, java.lang.Object value)Create a Filter where a Property equals a Literal |
|
boolean |
evaluate(Feature f)Evaluate the Filter against a Feature |
|
java.lang.String |
getCql()Get the CQL string from the Filter. |
|
Filter |
getNot()Get a new Filter that is the negation of the current Filter |
|
java.lang.String |
getXml(boolean pretty, double version)Get the XML string from the Filter. |
|
int |
hashCode()Returns the hash code value of the Filter |
|
static Filter |
id(java.lang.String id)Create Filter for a Feature ID |
|
static Filter |
ids(java.util.List ids)Create Filter for a List of Feature IDs |
|
static Filter |
intersects(java.lang.String fieldName, Geometry geometry)Create a Spatial Filter that intersects the given Geometry |
|
Filter |
negative()Get a new Filter that is the negation of the current Filter |
|
Filter |
or(java.lang.Object other)Combine the current Filter with another Filter in an OR relationship. |
|
Filter |
plus(java.lang.Object other)Combine the current Filter with another Filter. |
|
Filter |
simplify()Simplify this Filter |
|
java.lang.String |
toString()The string representation |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
The FAIL Filter wrapps the GeoTools EXCLUDE Filter
The PASS Filter wrapps the Geotools INCLUDE Filter
The GeoTools FilterFactory
The wrapped GeoTools Filter
Create a new Filter wrapping a GeoTools Filter
filter - The org.opengis.filter.FilterCreate a new Filter from an existing Filter
filter - The exiting FilterCreate a new Filter from a String (CQL or XML).
str - The String CQL or XML
Creating a Filter with CQL:
Filter f = new Filter("name='foobar')
Creating a Filter with XML:
Filter f = new Filter('<Filter><PropertyIsEqualTo><PropertyName>name</PropertyName><Literal>foobar</Literal></PropertyIsEqualTo></Filter>')
Combine the current Filter with another Filter.
other - Another Filter or a CQL StringCreate a Spatial Bounding Box Filter
fieldName - The geometry field name (defaults to the_geom)bounds - The BoundsCreate a Spatial Filter that contains the given Geometry
fieldName - The geometry field name (defaults to the_geom)geometry - The GeometryCreate a Spatial Filter that crosses the given Geometry
fieldName - The geometry field name (defaults to the_geom)geometry - The GeometryCreate a Spatial Filter that is within a certain distance of the given Geometry. There are some serious limitations to DWITHIN in Geotools. It does not work with projection EPSG:4326!
fieldName - The geometry field name (defaults to the_geom)geometry - The Geometrydistance - The distanceunits - The units (kilometers, meters, feet, ect...)Does this Filter equal another Filter?
Create a Filter where a Property equals a Literal
field - The name of the Propertyvalue - The literal valueEvaluate the Filter against a Feature
Get the CQL string from the Filter.
Get a new Filter that is the negation of the current Filter
Get the XML string from the Filter.
pretty - Whether the XML is pretty printed (defaults to true)version - The version (defaults to 1.0)Returns the hash code value of the Filter
Create Filter for a Feature ID
id - A Feature IDCreate Filter for a List of Feature IDs
ids - A List of Feature IDsCreate a Spatial Filter that intersects the given Geometry
fieldName - The geometry field name (defaults to the_geom)bounds - The BoundsGet a new Filter that is the negation of the current Filter
Combine the current Filter with another Filter in an OR relationship.
other - Another Filter or a CQL StringCombine the current Filter with another Filter.
other - Another Filter or a CQL StringSimplify this Filter
The string representation
Groovy Documentation