How To: Process curb stops
When solving for the shortest path, NetEngine uses the FlagAttRec structure (or flag) to let the network solvers know the points the path must follow. See the NetEngine online help for more information on FlagAttRec.
On two-way roads, flags placed along a road can generally be approached from either direction and the route can continue in either direction. In the case of a curb stop, such as bus or mail stops, uncrossable median strips, or stops sensitive to one side of the road versus the other, the network solvers must be told the flag is only on one side.
When a network is built, every road segment receives two edges. The digitized direction of the line is loaded into the network with its ID and placed on layer 1. The same line traversed in the opposite direction is placed on layer 2.
A stop is determined by how the flag is created. When you make the flag, you populate the HAtt/Position data as well as the AltHAtt/AltPosition data in the FlagAttRec structure. As result, the flag sits on both edges, and you ensure the flag along an edge can be approached and departed in either direction. In the case of a curb stop, a flag should only be approached from one direction and should be departed in the same direction.
When you place a curb stop flag on the network, you need to determine whether the stop is on layer 1 or layer 2. To do so, start with the digitized direction of the original road line used to build the network. For example:
Let's say you have a road segment that runs north-south. The digitized direction of the line has the start node in the south, and the line draws up to the end node in the north. For a bus going north on that road and making a stop, put the network flag on layer 1. South would be layer 2. If your flag needs to be on layer 1, populate the HAtt and Position fields of the FlagAttRec structure and don't populate the AltHAtt nor AltPosition fields. Do the opposite for layer 2.
How to code this depends on how the information about these curb stops is presented to the application.
- If you use MapObjects to provide the user with the ability to interactively click the map to create the curb stops, you must instruct the user to click one side of the road or the other.
You must rely on some geometry, or some creative use of MapObjects geometric methods to determine if the curb stop was placed on the right or left side of the line, in relation to the digitized direction of the line. For transportation systems where vehicles drive on the right, a curb stop placed on the right side of the line should be used to create a flag for layer 1 of the flag as described above (HAtt/Position). Curb stops placed to the left of the line should be on layer 2 (AltHAtt/AltPosition).
- If you use a narrative description of the curb stop as input information on where the stop should be placed, you will also need to be creative in writing the application. For example:
Route 495, northbound, milepost 124.4.
Your routine will need to locate the position of milepost 124.4 on Route 495. Once the point is found, an examination of the associated physical line will need to determine whether or not northbound most closely matches the digitized direction of the line, or is opposite; then, populate the FlagAttRec as described above.