Many of the inputs into Envision can include a spatial query that determines the spatial extent of the phemonemna of interest. ENVISION includes a simple query language and built in query compiler that can be used to:

  1. Specify site attribute for policies, to indicate where in the landscape the policy may be applied,
  2. To run queries on the map to locate IDU’s matching specific attribute criteria, and
  3. To specify inputs into certain evaluative models and autonomous processes.

The syntax for this language is very straightforward and consists most fundamentally of Field | operator | value triplets. These may be logically ‘and’ed or ‘or’ed together and arbitrarily nested to create complex queries. Additionally, the Query language supports several spatial operators to incorporate neighborhood information into the query.

The [Field | operator| value] triplets are the fundamental query elements and are defined as follows:

Complex queries can be constructed using the AND and OR operator to connect the field|operator| value triplets, with optional nesting with parentheses. These operators are not case sensitive. Examples include:

Mathematical expression can be included in queries using the usual math operators as follows:

OperatorDefinitionApplicable Types
+AdditionAny numeric
-SubtractionAny numeric
/DivisionAny numeric
*MultiplicationAny numeric
%Modulus (remainder) functionAny numeric

In addition to basic field|operator|value triplets, several spatial operators can be incorporated into a query. These operators are:

NextTo( query )Returns True if the IDU is adjacent to an IDU that satisfies the query argumentquery: Any valid queryNextTo( LULC_A = 3 )
NextToArea( query )Returns the area of the region adjacent to an IDU that satisfies the query argument. The area returned is an extended area, meaning it finds all IDUs that define a continuous region around the target IDU, even if some of those IDU’s are not directly adjacent to the target IDU.query: Any valid queryNextToArea( LULC_A=40 ) > 500
Within(query, distance)Returns True is the IDU is within the specified distance of any IDU that satisfies the query argumentquery: Any valid query
distance: a numeric distance, in map units
Within( SLOPE < 10, 100 )
WithinArea (query,radius,percent)Returns True if the percent area of IDU’s satisfying the query argument within the circle around the center of the IDU is greater than the specified percentage.query: Any valid query
radius: a numeric distance
percent: the decimal percent threshold
WithinArea( DENS<100, 1000, 0.20)
This is true if within a radius of 1000 of the centroid of the IDU, the DENS value of the IDU areas falling within that radius is less than 100 for at least 20 percent of the area.

These spatial operators can be combined into complex queries in a manner similar to the field|operator|value triplets, e.g.:

The following temporal operators can be incorporated into a query:

Time()Returns the current value of teh simulated time.NoneTime() < LASTTIME

One two constants are defined by the query language, TRUE (which evaluates to 1), and FALSE (which evaluates to 0). These are not case sensitive, so TRUE, true, and TRue all evaluate the same way. These are generally useful for comparing values returned from Boolean database fields.

Comments can be embedded in spatial queries to greatly improve readability and interpretability of the query string. Anything enclosed in matched braces ( { } ) is considered a comment and ignored by the Query compiler. For example: