HOW TO

Label line features with odd-numbered values on one side of the line and even-numbered values on the other

Last Published: April 25, 2020

Summary

Line features can be labeled with numbered values with odd values on one side and even values on the other side using SQL expressions.

The given example is a line feature class with a series of address numbers for a downtown city area. For each city block, the lowest number (the first available street number for that block) is an even number. The highest number (the last available street number for that block) is an odd number. The instructions provided describe how to label these line features such that the numbers appear on opposite sides of the feature.

To specifically label street addresses, refer to the Related Information section below.

Procedure

Instructions provided describe how to set up label classes by odd and even values, and set offsets for each class, in either ArcGIS Pro or ArcMap.

ArcGIS Pro

  1. Open ArcGIS Pro, and load a project and/or add data to a map to be labeled.
  2. If the feature class is not already labeled, on the top ribbon, under Feature Layer, select Labeling and click Label. Or, right-click the feature class in the Table of Contents and select Label.
Right-click the layer and click Label
  1. Next to Class, click the drop-down menu > Create Label Class. Name the class Label_odd.
Click the Class drop-down menu
Create a new label class, named Label_odd
  1. Next to the 'Label_odd' Class drop-down menu, click the SQL Query button.
Click the SQL Query button
  1. The Label Class pane opens. Click the Switch To Edit SQL Mode button.

    Switch to Edit SQL Mode in the Label Class pane
     
  2. In the text box, type MOD(<name of the field>,2)<>0. In this example, the 'R_T_Num' field lists the last odd-numbered value for the section of the street.
Type the query into the Label Class query text box
  1. Verify the expression, and click Apply. Disregard the message stating the expression cannot be edited in Clause mode.
The SQL expression is valid
  1. Create a Label_even class, or rename the default 'Class 1' class.
  2. Follow steps 3 through 6 for 'Label_even'. For Step 5, write 'MOD(<name of the field>,2)=0'.
  3. Determine which label class must appear below the line, and open the Label Class pane for those labels. In the Label Class pane, click Position.
Click the Position tab in the Label Class pane
  1. Expand the Placement tree view. Change the Constrain Offset setting to Below line, and change other values as needed.
Adjust the offset placement settings for the label class

When the settings are adjusted as needed, the label positioning can be saved for future iterations by clicking the hamburger icon on the top-right corner of the Label Class pane and saving the position as a style.

ArcMap

  1. Open ArcMap, and load the project to be labeled.
  2. If the Labeling toolbar is not already visible, from the main menu, navigate to the Customize drop-down menu, and select Toolbars > Labeling.
  3. On the Labeling toolbar, click the Labeling drop-down, and click Use Maplex Label Engine.
Click the Use Maplex Label Engine option from the Labeling toolbar in the Labeling drop-down menu
  1. If the line features are not already labeled, right-click the feature class in the Table of Contents, and click Label Features.
  2. Click the Label Manager button   Label Manager button on the Labeling toolbar to open the Label Manager dialog box.
     
  3. Click the 'Default' label class for the layer. Right-click and select Rename Class, and name the class Label_even. Click OK.
Right-click the Label Class name and select Rename Class
  1. Click the name of the layer, and in the Add label class text box, type Label_odd. Click Add.
The name of the layer is highlighted in the Label Classes tree view, and the Add Label Class text box contains 'Label_odd'
  1. Select the Label_even label class. In the Label Field drop-down menu, select the field to be labeled for the layer. Towards the bottom of the dialog, click the SQL Query button.
Click the SQL Query button in the Label Manager dialog window
  1. In the query text window, type mod(<name of field>,2)=0. Click the Verify button to verify the expression. Click OK.
  2. Select the Label_odd label class. Repeat steps 8 and 9, writing mod(<name of field>,2)<>0 for the SQL query expression.
Red boxes highlight the selection of the label class, and the SQL Query window with the MOD query
  1. Click Apply to produce the changes.
  2. Determine which label class must appear below the line. In the Label Manager dialog, under Placement Properties, verify that Regular Placement is selected.
  3. Click the Position button, and verify that 'Offset Straight' or 'Offset Curved' is selected. Click OK.
The Offset Straight setting is selected in the Position Options window
  1. Under Placement Properties, click Properties > Label Offset, and change the Constrain Offset value to Below Line. Change the other offset values as needed. Click OK > OK > Apply.
Constrain Offset is to be set to Below Line in the Label Offset dialog window

Article ID: 000012751

Software:
  • ArcMap
  • ArcGIS Pro

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options