How To: Reorder the records of complex line segments sequentially
In some cases, it might be necessary to reorder the records in the table of a feature class in a sequence according to the features' geographic progression. The Sort (Data Management) tool provides the functionality to sort the records of features based on one or multiple fields. However, the Sort tool has limitations in the spatial sort methods (UL, UR, LL, LR, and PEANO), and gives incorrect results for more complex features.
The instructions provided describe how to reorder the records of complex line segments in a sequence based on the geographic progression of the features.
In a file geodatabase, create a feature dataset and store the line feature class in the created feature dataset. Refer to the following document on how to create the feature dataset: Creating a feature dataset.
Create a geometric network of the line feature class. Notice there are two new feature classes (Street_Net and Street_Net_Junctions) automatically created in the feature dataset after the geometric network is built.
Add the created geometric network feature classes to the map.
Create a route from the geometric network using the Create Routes tool. Navigate to Linear Referencing Tools > Create Routes.
Select the geometric network feature class created in Step 2 as the Input Line Features.
For the Route Identifier Field, select a field that has the same attribute or record for every feature in the drop-down list.
If there is no field containing the same attribute for all features, select the Enabled field. In the geometric network feature class, a field named Enabled is created in the attribute table, and the attribute of all features for the field are set to True.
Set a name and location for the Output Route Feature Class.
Click OK, leaving other settings to default. A new route feature class is created. The output is a single line feature.
Run the Locate Features Along Routes tool. Navigate to Linear Referencing Tools > Locate Features Along Routes.
Select the junction points feature class created in Step 2 as the Input Features.
Select the route feature class created in Step 3 as the Input Route Features.
Select the same field as in Step 3(b) as the Route Identifier Field.
Type 1 in the Search Radius parameter.
Set a name and location for the Output Event Table.
Leave the default setting of the Measure Field to MEAS. This field is used to reorder the ObjectID fields in Step 7(c).
Click OK. The output created is a table.
Join the created table in Step 4 to the junction points feature class created in Step 2, to append the fields in the table to the fields in the attribute table of the junction points feature class. Right-click the junction points feature class in the Table Of Contents > Joins and Relates > Join.
Select Join attributes from a table.
Select the ObjectID field from the Choose the field in this layer that the join will be based on drop-down list.
Select the table created in Step 4 to join to the junction points feature class.
Select the ObjectID field from the Choose the field in the table to base the join on drop-down list.
Click OK. The fields in the table are appended to the attribute table of the junction points feature class.
Export the junction points feature class to make the join permanent. Refer to the following document on how to export features: Exporting features. A new point feature class is created.
Run the Spatial Join tool. Navigate to Analysis Tools > Overlay > Spatial Join.
Select the original line feature class as the Target Features.
Select the exported point feature class in Step 5(e) as the Join Features.
Set a name and location for the Output Feature Class.
Select JOIN_ONE_TO_ONE as the Join Operation.
Select INTERSECT as the Match Option.
Click OK. A new feature class of the spatial join operation is created.
Run theSort tool. Navigate to Data Management Tools > General > Sort.
Select the feature class created in Step 6 as the Input Dataset.
Set a name and location for the Output Dataset.
Select the MEAS field in the Field(s) drop-down list to reorder the ObjectID fields based on the measured distance from right to left along the line.
Click OK. The records of the complex line segments are reordered in a sequence based on the geographic progression.