Overview of Expressions for Geospatial Features

An expression is the part of a query that specifies its conditions. A query evaluates data and returns only the subset of data that meets the conditions of the query.

For example, you can create an expression that specifies all parcels whose area is larger than 4000 square feet. A query containing this expression displays or selects only parcels that meet those criteria.

A complete query also specifies the following:

For example, you can query a feature layer in a map and display or hide its data based on whether it meets the query conditions.

In practice, you specify the data set by selecting the feature class or layer to query before you build the expression. You specify the action to apply when you select the command that lets you build the expression. For example, in AutoCAD Map 3D toolset, select Add To Map With Query or Search To Select.

The title bar for the dialog box in which you create expressions is different, depending on the command you choose. The contents of the dialog box are much the same, no matter what it is called.

Use expressions to filter geospatial data, select a subset of data, calculate values, or convert data from one data type to another. Use text expressions to format text strings for display, for example, as labels. Use numeric expressions to apply math functions to properties with numeric values.

The text in the title bar changes, depending on which command you select.

Basic Steps for Creating Expressions

To create an expression, follow these basic steps:

Ways to Use Expressions Description
Evaluating Properties

You can filter or select data based on the value of one or more properties.

A simple expression evaluates a single property, but you can create complex expressions that use multiple properties or multiple values. For example, you could create an expression that shows counties with a population over 50,000 but under 100,000.

The result of a filter expression must be a Boolean value.

Creating a Calculation

You can calculate a new value based on existing values. For example, you can do the following:

  • Calculate the area of a polygon or the length of a linear feature.
  • Convert a text string to a date format and add days or months to the resulting date.
Performing a Conversion

Conversions change data values from one data type to another. For example, if a data store keeps date values as text, you can convert these values to date strings. Then you can use Date Functions on them.

You can also convert numeric or text strings to a particular numeric format, for example to a single- or double-precision number. You can convert numeric values into text strings, for example, to extract a substring or find the number of characters in the string.

Creating Text Expressions

With text expressions, you can analyze and manipulate strings. For example, you can do the following:

  • Format multiline labels.
  • Concatenate multiple properties into a single entry. For example, concatenate First_Name and Last_Name to get Full_Name.
  • Find the length of a text string, or the position of one text string within another.
  • Convert a text string to all uppercase or lowercase characters.
  • Trim or add to the beginning or end of a text string.
  • Replace one set of characters with another.
Creating Numeric Expressions

Numeric expressions operate only on numeric values. They use math functions, with which you can analyze and manipulate numeric strings. For example, with numeric expressions, you can do the following:

  • Round a value up or down.
  • Find the square root of a value, use trigonometric functions, or determine the remainder of a number after it is divided by another number.
  • Find the average, mean, or median of a set of values.
Using Expressions to Filter Feature Data

With filters, you can work with a subset of your data. For example, if your map includes all the counties in California, you can create a filter to show only counties with a population over 50,000.

Use expressions to do the following:

Using Expressions to Label Features

Use a text expression or a numeric expression to determine the content of labels when you style your map.

Using Expressions In Split/Merge Rules

Use expressions in AutoCAD Map 3D toolset to determine how property values are specified after merging or splitting features.