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:
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:
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.