Overview of Expressions for Geospatial Features

Autodesk Expression Builder

 
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 query’s conditions.

For example, an expression might specify all parcels on a particular street whose area is larger than 4000 square feet. Only parcels that meet those criteria are displayed or selected by a query containing this expression.

A complete query also specifies the set of data to which the conditions are applied and the action to apply to the data that meets the conditions. For example, you can query a particular feature layer in a map and either display or hide data in that layer, depending on whether it meets the query conditions or not.

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, you might select Query to Add To Map or Search To Select.

The title bar for the dialog box in which you create expressions will be 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:

  • Specify the data to which the expression will be applied. For example, select the layer to filter.
  • Select a command that can use an expression. For example, right-click a layer and select Filter To Select.
  • Use an expression to specify the conditions for the command. For example, create an expression to specify the subset of features on the layer to select.
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 so 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 sub-string 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 those 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 to determine how property values are specified after you merge multiple features into one or split a single feature into multiple features.