Geospatial Modelling Environment


The where clause allows you to define a subset of records to process using a query


The ‘where’ clause is not a command, but a common argument to many of the tools that process vector data. It is an important aspect of GME that will help you to be more efficient, and is therefore worth learning about. It allows you to specify a query (an SQL query) that defines a subset of records to process. This means that you do not need to split datasets apart when you only want to process a subset of the data. This makes for much more efficient data management and analysis.

The expression is written using SQL-style syntax. It involves combining field names, operators, values, and logical operators. The convention is to write the field names in uppercase as they appear in the attribute table. Although the entire clause is enclosed in a single pair of quotes, do not put quotes around field names.

The equality operators are:

  1. = equal to
  2. < less than
  3. > greater than
  4. <> not equal to
  5. >= greater than or equal to
  6. <= less than or equal to
  7. Like (matches portions of a string value)

The values are typically either numbers or strings (string MUST be enclosed in single quote marks). You can also use arithmetic expressions (+, -, *, /). Refer to the ESRI help documentation for more details.

The logical operators are: AND, OR. Parentheses ( ) can be used to group expressions.

It is highly recommended that you experiment with the addcodedfield command when you are learning about the where clause. This command allows you to add a new field and code it with values in a number of ways, therefore providing an easy way of checking whether the where clause is selecting the subset of records you think it should be selecting.



is an SQL-style of expression based on the fields in the attribute table


where=”COUNTY=’WOOD’ AND YEAR=2009”


where=”FID < 10″


Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn