I'm creating a linear reference system for a set of routes throughout a city, measuring bus performance in both directions along each corridor. I've got a set of about 50 features (although this number may increase as the analysis changes) that need routes created for each corridor. Each corridor has two feature classes assigned to it, one for each direction along the corridor. For further steps in the analysis, each corridor's direction must be a unique feature.

Rather than manually creating a route for each corridor/direction, I would like to automate the process in Modelbuilder. However, I am stuck trying to figure out a was to automate the assignment of coordinate priority. The corridors run both N-S and E-W, and am not sure how to generate the correct priority for each feature, as it only has directionality based on how the feature was drawn, rather than route measures.

I'm currently working on a Python script (using dkwiens's answer in this thread's as a guide) that will add each FC's bearing to a field, which will need to be re-classed to NW/NE/SW/SE values that match the syntax from the Create Routes tool. I have two questions:

How do I reclassify the bearing ranges to NW/NE/SW/SE values? A table join wouldn't recognize a range of values, so I'm at a loss here.

How do I then tell the Create Routes tool to pull the bearing from this value? The tool's syntax appears to require specific inputs, rather than a field value (as far as I can tell).

I am also not averse to Python, although my scripting abilities are not amazing, and the tool is going to be distributed among multiple employees, some of whom do not know any Python scripting at all.

I'm working in ArcMap Advanced 10.4.1


Using the Calculate Field step and the following code, I was able to add coordinate priority values to each features table:

Code Block:

def ifBlock(BEARING):
if 0 <= BEARING <=90:
    return "UPPER_RIGHT"
elif 90.0001 <= BEARING <= 180:
    return "LOWER_RIGHT"
elif 180.0001 <= BEARING <= 270:
    return "LOWER_LEFT"
elif 270.0001 <= BEARING <= 360:
    return "UPPER_LEFT"



Working in Modelbuilder, I was able to reconstruct my process and set up what looks to be the correct workflow, save for one issue. Screencapture attached:

Modelbuilder Process

I need to pass the output of the "Get Field Value", which has an output which matches the list of inputs for Coordinate Priority in the "Create Routes" tool. Right now the workflow ignores the "Value" output (which is set as a precondition for Create Routes) and uses the exact string input from the "Coordinate Priority" variable bubble.

I've tried using inline variables (%Value%) in the string input for the Coordinate Priority variable, but this is returned as an invalid input for the Create Routes tool.

How can I use the "Value" output from Get Field Value as the input for either my Coordinate Priority variable bubble, or as the direct input for the Create Routes tool?

I feel like I'm quite close, but am using the wrong data type, or need to feed my output into the variable using a specific tool/parameter.

  • You need to use end points to calibrate routes. – FelixIP Oct 13 '16 at 19:07
  • @FelixIP I'm not even at the step of calibrating the routes yet. I need to create them first, and need to give each route the correct start/end point. I'm not going to recalibrate them; I'm accumulating measures based on length when they are first created. – JonR Oct 13 '16 at 23:25
  • Steps are: a) create and b)calibrate unless your line is near straight thing going SW – FelixIP Oct 14 '16 at 0:12


enter image description here

arcpy.CreateRoutes_lr("sketch", "NAME", "D:/Scratch/routes.shp", "LENGTH", "UPPER_LEFT")
arcpy.FeatureVerticesToPoints_management("routes", "D:/Scratch/pointsM.shp",”ALL")


enter image description here

arcpy.FeatureVerticesToPoints_management(in_features="sketch", out_feature_class="D:/Scratch/ends.shp", point_location="BOTH_ENDS")
arcpy.CalculateField_management(in_table="ends", field="Measure", expression="5936.781377", expression_type="VB", code_block="")
arcpy.CalibrateRoutes_lr("routes", "NAME", "ends", "NAME", measure_field="Measure","D:/Scratch/calibrated.shp", "DISTANCE")

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.