Filter Function Reference¶
This reference describes all filter functions that can be used in WFS/WMS filtering or in SLD expressions.
The list of functions available on a GeoServer instance can be determined by
browsing to http://localhost:8080/geoserver/wfs?request=GetCapabilities
and searching for ogc:FunctionNames
in the returned XML.
If a function is described in the Capabilities document but is not in this reference,
then it might mean that the function cannot be used for filtering,
or that it is new and has not been documented. Ask for details on the user mailing list.
Unless otherwise specified, none of the filter functions in this reference are understood natively by the data stores, and thus expressions using them will be evaluated inmemory.
Function argument type reference¶
Type 
Description 
Double 
Floating point number, 8 bytes, IEEE 754. Ranges from 4.94065645841246544e324d to 1.79769313486231570e+308d 
Float 
Floating point number, 4 bytes, IEEE 754. Ranges from 1.40129846432481707e45 to 3.40282346638528860e+38. Smaller range and less accurate than Double. 
Integer 
Integer number, ranging from 2,147,483,648 to 2,147,483,647 
Long 
Integer number, ranging from 9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 
Number 
A numeric value of any type 
Object 
A value of any type 
String 
A sequence of characters 
Timestamp 
Date and time information 
Comparison functions¶
Name 
Arguments 
Description 
between 

returns true if 
equalTo 

Can be used to compare for equality two numbers, two strings, two dates, and so on 
greaterEqualThan 

Returns true if 
greaterThan 

Returns true if 
in2, in3, in4, in5, in6, in7, in8, in9, in10 

Returns true if 
in 

Works exactly the same as the in2, …, in10 functions described above, but takes any number of values as input. 
isLike 

Returns true if the string matches the specified pattern. For the full syntax of the pattern specification see the Java Pattern class javadocs 
isNull 

Returns true the passed parameter is 
lessThan 

Returns true if 
lessEqualThan 

Returns true if 
not 

Returns the negation of 
notEqual 

Returns true if 
Control functions¶
Name 
Arguments 
Description 
if_then_else 

Returns 
Environment function¶
This function returns the value of environment variables
defined in various contexts.
WMS GetMap automatically defines somes variables SLD rendering,
while others can be provided using the env
request parameter.
Example usage in e.g. a dynamic symbolizer:
${env('size', 20)}
Example usage in a default Symbolizer:
<PointSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
<Graphic>
...
<Size>
<ogc:Function name="env">
<ogc:Literal>size</ogc:Literal>
<ogc:Literal>20</ogc:Literal>
</ogc:Function>
</Size>
</Graphic>
</PointSymbolizer>
Name 
Arguments 
Description 
env 

Returns the value of the environment variable 
Feature functions¶
Name 
Arguments 
Description 
id 

returns the identifier of the feature 
PropertyExists 

Returns 
property 

Returns the value of the property 
mapGet 

Get the value of the map 
Spatial Relationship functions¶
For more information about the precise meaning of the spatial relationships consult the OGC Simple Feature Specification for SQL
Name 
Arguments 
Description 
contains 

Returns true if the geometry 
crosses 

Returns true if 
disjoint 

Returns true if the two geometries are disjoint, false otherwise 
equalsExact 

Returns true if the two geometries are exactly equal, same coordinates in the same order 
equalsExactTolerance 

Returns true if the two geometries are exactly equal, same coordinates in the same order, allowing for a 
intersects 

Returns true if 
isWithinDistance 

Returns true if the distance between 
overlaps 

Returns true 
relate 

Returns the DE9IM intersection matrix for 
relatePattern 

Returns true if the DE9IM intersection matrix for 
touches 

Returns true if 
within 

Returns true is fully contained inside 
Geometric functions¶
Name 
Arguments 
Description 
area 

The area of the specified geometry. Works in a Cartesian plane, the result will be in the same unit of measure as the geometry coordinates (which also means the results won’t make any sense for geographic data) 
boundary 

Returns the boundary of a geometry 
boundaryDimension 

Returns the number of dimensions of the geometry boundary 
buffer 

Returns the buffered area around the geometry using the specified distance 
bufferWithSegments 

Returns the buffered area around the geometry using the specified distance and using the specified number of segments to represent a quadrant of a circle. 
centroid 

Returns the centroid of the geometry. Can be often used as a label point for polygons, though there is no guarantee it will actually lie inside the geometry 
convexHull 

Returns the convex hull of the specified geometry 
difference 

Returns all the points that sit in 
dimension 

Returns the dimension of the specified geometry 
distance 

Returns the euclidean distance between the two geometries 
endAngle 

Returns the angle of the end segment of the linestring 
endPoint 

Returns the end point of the linestring 
envelope 

Returns the polygon representing the envelope of the geometry, that is, the minimum rectangle with sides parallels to the axis containing it 
exteriorRing 

Returns the exterior ring of the specified polygon 
geometryType 

Returns the type of the geometry as a string. May be 
geomFromWKT 

Returns the 
geomLength 

Returns the length/perimeter of this geometry (computed in Cartesian space) 
getGeometryN 

Returns the nth geometry inside the collection 
getX 

Returns the 
getY 

Returns the 
getZ 

Returns the 
interiorPoint 

Returns a point that is either interior to the geometry, when possible, or sitting on its boundary, otherwise 
interiorRingN 

Returns the nth interior ring of the polygon 
intersection 

Returns the intersection between 
isClosed 

Returns true if 
isEmpty 

Returns true if the geometry does not contain any point (typical case, an empty geometry collection) 
isometric 

Returns a MultiPolygon containing the isometric extrusions of all components of the input geometry. The extrusion distance is 
isRing 

Returns true if the 
isSimple 

Returns true if the geometry self intersects only at boundary points 
isValid 

Returns true if the geometry is topologically valid (rings are closed, holes are inside the hull, and so on) 
numGeometries 

Returns the number of geometries contained in the geometry collection 
numInteriorRing 

Returns the number of interior rings (holes) inside the specified polygon 
numPoint 

Returns the number of points (vertexes) contained in 
offset 

Offsets all points in a geometry by the specified X and Y offsets. Offsets are working in the same coordinate system as the geometry own coordinates. 
pointN 

Returns the nth point inside the specified geometry 
startAngle 

Returns the angle of the starting segment of the input linestring 
startPoint 

Returns the starting point of the input linestring 
symDifference 

Returns the symmetrical difference between 
toWKT 

Returns the WKT representation of 
union 

Returns the union of 
vertices 

Returns a multipoint made with all the vertices of 
Math functions¶
Name 
Arguments 
Description 
abs 

The absolute value of the specified Integer 
abs_2 

The absolute value of the specified Long 
abs_3 

The absolute value of the specified Float 
abs_4 

The absolute value of the specified Double 
acos 

Returns the arc cosine of an 
asin 

Returns the arc sine of an 
atan 

Returns the arc tangent of an angle in radians, in the range of 
atan2 

Converts a rectangular coordinate 
ceil 

Returns the smallest (closest to negative infinity) double value that is greater than or equal to 
cos 

Returns the cosine of an 
double2bool 

Returns 
exp 

Returns Euler’s number e raised to the power of 
floor 

Returns the largest (closest to positive infinity) value that is less than or equal to 
IEEERemainder 

Computes the remainder of 
int2bbool 

Returns true if 
int2ddouble 

Converts 
log 

Returns the natural logarithm (base 
max, max_3, max_4 

Returns the maximum between 
min, min_3, min_4 

Returns the minimum between 
pi 
None 
Returns an approximation of 
pow 

Returns the value of 
random 
None 
Returns a Double value with a positive sign, greater than or equal to 
rint 

Returns the Double value that is closest in value to the argument and is equal to a mathematical integer. If two double values that are mathematical integers are equally close, the result is the integer value that is even. 
round_2 

Same as 
round 

Returns the closest Integer to 
roundDouble 

Returns the closest Long to 
sin 

Returns the sine of an 
tan 

Returns the trigonometric tangent of 
toDegrees 

Converts an angle expressed in radians into degrees 
toRadians 

Converts an angle expressed in radians into degrees 
String functions¶
String functions generally will accept any type of value for String
arguments.
Nonstring values will be converted into a string representation automatically.
Name 
Arguments 
Description 
Concatenate 

Concatenates any number of strings. Nonstring arguments are allowed. 
strAbbreviate 

Abbreviates the sentence at first space beyond 
strCapitalize 

Fully capitalizes the sentence. For example, “HoW aRe YOU?” will be turned into “How Are You?” 
strConcat 

Concatenates the two strings into one 
strDefaultIfBlank 

returns 
strEndsWith 

Returns true if 
strEqualsIgnoreCase 

Returns true if the two strings are equal ignoring case considerations 
strIndexOf 

Returns the index within this string of the first occurrence of the specified substring, or 
strLastIndexOf 

Returns the index within this string of the last occurrence of the specified substring, or 
strLength 

Returns the string length 
strMatches 

Returns true if the string matches the specified regular expression. For the full syntax of the pattern specification see the Java Pattern class javadocs 
strReplace 

Returns the string with the pattern replaced with the given replacement text. If the 
strStartsWith 

Returns true if 
strStripAccents 

Removes diacritics (~= accents) from a string. The case will not be altered. 
strSubstring 

Returns a new string that is a substring of this string. The substring begins at the specified 
strSubstringStart 

Returns a new string that is a substring of this string. The substring begins at the specified 
strToLowerCase 

Returns the lower case version of the string 
strToUpperCase 

Returns the upper case version of the string 
strTrim 

Returns a copy of the string, with leading and trailing blankspace omitted 
Parsing and formatting functions¶
Name 
Arguments 
Description 
dateFormat 

Formats the specified date according to the provided format. The format syntax can be found in the Java SimpleDateFormat javadocs 
dateParse 

Parses a date from a 
numberFormat 

Formats the number according to the specified 
parseBoolean 

Parses a string into a boolean. The empty string, 
parseDouble 

Parses a string into a double. The number can be expressed in normal or scientific form. 
parseInt 

Parses a string into an integer. 
parseLong 

Parses a string into a long integer 
Temporal functions¶
Name 
Arguments 
Description 
dateDifference 

Computes the difference between two date (as ab) and return a result in a specific time units. 
now 
None 
Retuns the current time as a Date 
Transformation functions¶
Transformation functions transform values from one data space into another. These functions provide a concise way to compute styling parameters from feature attribute values. See also Styling using Transformation Functions.
Name 
Arguments 
Description 
Recode 

Transforms a 
Categorize 

Transforms a continuousvalued attribute value into a set of discrete values.

Interpolate 

Transforms a continuousvalued attribute value into another continuous range of values.
Any number of 