Package dev.avelar.mapnik
Class Expression
java.lang.Object
dev.avelar.mapnik.Expression
- All Implemented Interfaces:
AutoCloseable
A parsed expression in Mapnik's expression language, the one used in rule filters and text labels:
[population] > 1000 and [kind] = 'city', [name] + ' (' + [pop] + ')',
[elevation] * 3.28084. Attribute names go in brackets, text in single quotes, and
@name refers to a variable you pass when you evaluate.
Use it to check a filter before putting it in a style, or to filter features in Java the same way Mapnik will. Holds native memory: close it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Evaluate against a feature.Asevaluate(Feature), with values for the@namevariables the expression uses.static booleanTrue iftextparses.booleanWhether a feature passes this expression used as a filter: true, non-zero or non-empty counts as a match.booleanstatic ExpressionParse an expression.text()The text this expression was parsed from.toString()
-
Method Details
-
parse
Parse an expression. ThrowsMapnikExceptionwith Mapnik's message if it is not valid, so this doubles as a syntax check. -
isValid
True iftextparses. -
text
The text this expression was parsed from. -
evaluate
-
evaluate
Asevaluate(Feature), with values for the@namevariables the expression uses. -
matches
Whether a feature passes this expression used as a filter: true, non-zero or non-empty counts as a match. -
matches
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
toString
-