It is not really clear what problem you are trying to solve. Is it a problem of measure directions changing within a single route due to bad line topology and contradictory orientations of the input lines relative to the coordinate priority you chose? Or is this a problem of inconsistent directions between multiple routes that you want to control better so that you can predict the compass direction of the increasing measures of each route?
The Minimum Bounding Geometry tool can be applied to the routes to find out some aspects or overall route orientation, but it is not the entire solution. I do use this tool with the Rectangle by Width option to get the overall sense of the orientation of my routes. But it only really works if the route was built correctly to begin with.
I find that knowing the number of line parts that make up a route is the most important information, since single part routes are consistent within themselves. Single part routes only cause issues between itself and other routes for orientation issues and for them knowing the Minimum Bounding Rectangle is useful.
Routes that have internally inconsistent measures mess this up and only can apply to the routes that are made up of multiple line parts. So calculating a PARTS field is important. The Python field calculation for that field is:
!Shape.partCount!
The other field that is important for finding and fixing routes with internal measure problems due to branching or looping is MMONOTONIC, which tells if measures continually increase or if they are internally inconsistent within a single route. This value is also reported by the Identify Measure tool, but having it in a field is more useful for analyzing your whole route network than trying to use that tool one route at a time. The MMonotonicy values and their domain translations are:
1 = Strictly Increasing
2 = All Measures are Level
3 = Increasing with Levels
4 = Strictly Decreasing
5 = Increasing and Decreasing
6 = Decreasing with Levels
7 = Increasing and Decreasing with Levels
8 = All Measures are NaN
9 = Increasing with NaN
10 = Measures with Levels and NaN only
11 = Increasing with Levels and Nan
12 = Decreasing with NaN
13 = Increasing and Decreasing with NaN
14 = Decreasing with Levels and NaN
15 = Increasing and Decreasing with Levels and NaN
This field can be calculated with the field calculator with this Python calculation:
Parser: Python
Show Codeblock: Checked
Pre-Logic Script Code:
def MMonotonicity(feat):
partnum = 0
# Count the number of points in the current multipart feature
partcount = feat.partCount
pntcount = 0
mmonotonicity = 0
lastM = -100000000
# Enter while loop for each part in the feature (if a singlepart feature
# this will occur only once)
#
while partnum < partcount:
part = feat.getPart(partnum)
pnt = part.next()
# Enter while loop for each vertex
#
while pnt:
pntcount += 1
if lastM < pnt.M and lastM != -100000000:
mmonotonicity = mmonotonicity | 1
if lastM == pnt.M and lastM != -100000000:
mmonotonicity = mmonotonicity | 2
if lastM > pnt.M and lastM != -100000000:
mmonotonicity = mmonotonicity | 4
if not pnt.M:
mmonotonicity = mmonotonicity | 8
lastM = pnt.M
pnt = part.next()
# If pnt is null, either the part is finished or there is an
# interior ring
#
if not pnt:
pnt = part.next()
partnum += 1
return mmonotonicity
Expression: MMonotonicity( !Shape!)