You are on page 1of 56

ArcGIS Network Analyst data prep tutorial

Many people come across free street data they wish to use with the ArcGIS Network
Analyst extension. However, a lot of this data is missing essential fields, or it is not clean
enough, meaning NA (Network Analyst) will not be able to find good routes, service
areas etc. In fact, most free data will give only poor to fair results with NA. Higher
quality datasets are usually clean, but they may not have the desired fields such as drive
time or one-way streets. Most purchased data, such as TeleAtlas or NAVTEQ street
data, is clean and has the desired fields for use with NA, so these datasets need not
undergo the procedures described in this document.
Using the data that comes with this download, this document will step through an
example workflow for cleaning up some dirty data, and adding missing fields such as
drive time, one-way streets and many others. There are seven tutorials altogether.
Most of the exercises use a file geodatabase, but shapefiles and other geodatabase formats
are not so different in most cases. Brief comments will be noted wherever a shapefile user
would have to do something different.
An ArcView license is sufficient for all of these tutorials. This means that occasionally, a
less-efficient workflow that makes use of only ArcView functionality would be
demonstrated, as opposed to the more-efficient workflow that can only be performed with
a higher license. In such cases, these more efficient workflow(s) that make use of higher
licenses will be noted.
These tutorials are independent of each other, so you only have to do those you are
interested in. Having said that, Tutorials 1 and 2 go together very well. Also, the
instructions are less detailed as the tutorial progresses. For example, a common step in
many of these tutorials is to label ObjectIDs in the map. In Tutorial 2, you are walked
through the procedure, but in later tutorials, there is only a simple instruction to label the
ObjectIDs. If you are a bit weak in either ArcGIS or NA, it is recommended that you do
all of the tutorials in order.
U.S. data conventions and measurement units will be primarily used.
Assumptions:
Familiarity with the basics of ArcGIS and NA.
If you are not familiar with NA, do the ArcTutor NA Tutorial that comes
with the software. In ArcMap or ArcCatalog, go to Help > ArcGIS Desktop
Help, then type Network Analyst tutorial exercises into the Index tab.
ArcGIS 9.2 or higher.
Some of the tutorials will not work with earlier releases of the software.
The NA extension is turned on (in both ArcMap and ArcCatalog).

The NA toolbar and the NA Window are already displayed in ArcMap.


Those setting up a database from scratch should see the white paper Preparing Street
Data for Use with the Network Dataset, which has lots of helpful schema considerations.
It is located at
http://support.esri.com/index.cfm?fa=knowledgebase.whitepapers.viewPaper&PID=87&
MetaID=1068
Appendix 1 of this tutorial contains a list of recommended field names.
This tutorial will take approximately two hours for an experienced GIS analyst. A newer
user should set a full day aside.

3
Contents
Tutorial 1. Cleaning up bad digitizing ..............................................................................4
Tutorial 2. Planarization and elevation fields ....................................................................11
Tutorial 3. Adding a drive-time field .................................................................................19
Sub-tutorial. Adding a length field to a shapefile that uses geographic coordinates ...27
Tutorial 4. Making NA respect one-way streets ................................................................30
Tutorial 5. Using global turns ............................................................................................36
Tutorial 6. Digitizing turn features ....................................................................................40
Tutorial 7. A parameter-based restriction ..........................................................................50
Appendix 1. Good field names to use ...............................................................................56

4
Tutorial 1. Cleaning up bad digitizing.
This tutorial demonstrates how to clean up data with geometry problems. Most free data
has lots of this. What is meant by bad is that even though the data may be perfectly fine
for drawing maps and for many other purposes, NA will give poor results when using it.
Skip this tutorial if you are certain your dataset is topologically sound. If you are not
completely sure, read on to see why it is important to understand bad geometry, and learn
how to fix them.
1. Start ArcMap with an empty map document.
2. Add a pre-built network dataset to the map.
Click the Add Data button and navigate to the
Tutorial.gdb geodatabase (it should be in the
same folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the badGeometry feature dataset.
Double-click the badGeometry_ND network dataset.
Note that this network dataset was created using the default settings.
Click No when prompted to add all the feature classes.
3. On the Network Analyst toolbar, click Network Analyst, and click New Route.
These tutorials make use of New Route. However, other solvers, such as Service
Area would also be affected by bad geometry.
4. Use the Create Network Location Tool to add two stops as shown below:

Make sure both stops snap to the network (they


must not have a question mark inside of the Stop
icon) and make sure the left stop is added first.

5. Click Solve.
You will get the unexpected result shown below.

Why did it take such a long route?

6. Zoom way in on the routes first left turn (to the right of stop 1, where it turns north).
Notice that there is a gap in the streets, as shown below.
This gap is less than 0.001 foot, but to NA this means the streets are not
connected.

Note that you may have to zoom in multiple times on this intersection to see the gap.
This tutorial will later describe how to fix the above problem. For now lets look at
another common geometry problem.
7. Click Full Extent to zoom back out.
8. Use the Select/Move Network Locations Tool
location shown below :

to move stop 2 to the new

9. Click Solve.
Stop 2 will turn red and an error message will pop up, as shown in the diagram below:

Note that there are no gaps in this case. So why are we unable to get from stop 1 to stop
2?
10. Close the pop-up window.
When tracking down many geometry problems, adding the actual feature classes instead
of just adding the network dataset will help clarify the problem.
11. Click the Add Data button and add the streets and the
badGeometry_ND_Junctions feature classes.
Note that the network dataset was built from these feature classes.

6
The small circles in the map are the junction features.
With the junction feature class added, we can now
easily see what is causing this problem: there is no
junction between the street that stop 2 is on, and
its cross street. A junction must be present to turn
from one street to the other. This means these
streets are not connected, even though there is no
gap as in the previous problem.
The two problems shown in this tutorial (the gap between the streets and the missing
junction) are among the most common errors caused by poor digitizing. The free data we
commonly come across is usually full of these digitizing errors, along with many other
kinds of errors that are not discussed here. These kinds of problems can be avoided by
using the proper tools in ArcMap when digitizing the streets.
12. In ArcToolbox, open and run the Integrate tool.
Expand the Data Management Tools toolbox.
Expand the Feature Class toolset.
Double-click the Integrate tool.
Click on the dropdown arrow to the right of Input Features and choose streets.
Do not select the badGeometry ND_Junctions feature class since it is managed
by ArcGIS.
Note that if your network dataset is to be built from more than one feature
class, you would normally choose all of them.
Leave the XY Tolerance parameter blank.
A blank parameter means that ESRI will calculate a default value to use.
Click OK.
Important:
The XY Tolerance is a critical parameter on the Integrate tool. Normally, the XY
Tolerance should be set based on careful examination of the data. Use the Measure
tool to see how large this number needs to be to close the gaps in your street data.
Always perform Integrate against a copy of the data since a too large XY Tolerance
value will ruin the data -- the street geometry will be modified in very strange ways
with an inappropriate XY Tolerance setting. If a large XY Tolerance setting is
needed, such as anything greater than a few feet, you should use the Integrate tool
only to fix the smaller problems, and then fix the larger problems by hand using
standard ArcMap editing tools. If the XY Tolerance setting is too small, the data will
not be modified too greatly, but very few problems will be fixed. When the XY
Tolerance is just right, most of the digitizing problems will be fixed without harming
your data. It usually takes trial-and-error testing to find the ideal XY Tolerance.
13. Run the Build Entire Network Dataset command.

7
Remember that the network dataset must be rebuilt anytime an edit is made to the
network data (Integrate is considered an edit). If the network dataset is not rebuilt, then
the next time you perform a Solve, the results will be consistent with the unedited data.
14. Move stop 2 back to the position shown
to the left, and click Solve.
The results are now as expected, as running
the Integrate tool closed the tiny gap.
Zooming way in on the intersection you
zoomed to in Step 6, notice that all four
streets are now connected to one another at
the intersection to the right of stop 1.
The take-home lesson is even microscopic gaps must be fixed before NA will work well.
There are many other ways to fix these gaps, but they tend to be much more timeconsuming than using the Integrate tool. Always run Integrate against any free data,
unless you know that it is clean.
15. Move stop 2 back to the position shown in Step 8, and click Solve.
Notice that the Solve will still fail as it did before. This is because we need to change the
way the network dataset is set up, which is done in ArcCatalog. Before doing this,
though, lets look at what the Integrate tool did to this problem area.
16. Click the Close button on the pop-up window.
17. Draw the lines vertices in the map.
Start an edit session.
Double-click the line that
stop 2 is on.
Note that in the diagram to the
right, the junction symbols are
enlarged so that they would not
be confused for vertices it is
not necessary to enlarge these
features.
Note the square green colored vertex in the middle of the line. This vertex was not in the
data before -- the Integrate tool added it. If you examine the cross street, you will see it
also has a new vertex in the exact same location. Whenever there are two coincident
vertices belonging to different features (as there are now because of using the Integrate
tool) NA can consider these two streets to be connected.
18. Exit ArcMap.

8
Click File, then click Exit. Be sure to save the .mxd file. Save the file as
Tutorial1.mxd.
You will not be able to complete the following steps if ArcMap is running.
19. Start ArcCatalog and navigate to the network dataset badGeometry_ND.
See the selected item in the screenshot from Step 2.
20. Right-click on the network dataset and click Properties.
21. Click on the Connectivity tab, change the Connectivity Policy of streets from End
Point to Any Vertex, and click OK.

The End Point option (which was the original setting network dataset was built with)
means lines could only connect at endpoints. The Any Vertex option allows the two line
features we examined in Step 16 to connect mid-span at the coincident vertices.
Note that the Integrate tool must be run to add the two new vertices. Otherwise, the
Any Vertex option will not connect those two features unless there were coincident
vertices present.
22. Right-click the network dataset and click Build.
The new network dataset is identical to the original one, except it is using the Any Vertex
option instead of End Point.
23. Start ArcMap and open the .mxd file saved in Step 18:
Note the new network junction. This
junction was not present in the original
network dataset we worked with (see the
diagram in Step 11, for comparison).
The Integrate tool added the coincident
vertices needed so that the Any Vertex
option would consider the two streets to
be connected.

9
Note that this has not split the street features.
24. Use the Select Features tool to verify that
there are still only two street features (see the
diagram to the right).

However, there are now four network edges.

25. Use the Network Identify tool to verify


that there are four network edges at that
intersection (see the diagram to the right).

26. Click Solve.

Notice that the results are now as expected.


The take home lesson is that NA does not connect streets just because they look like they
should be connected. There must be proper topological connectivity.
27. Exit both ArcCatalog and ArcMap (it is not necessary to save the changes to the map
document), since Tutorial 1 is finished.

10
Summary:
The Integrate / Any Vertex approach works well for lines that pass over one another, but
should be connected (also known as unresolved intersections). Before running Integrate,
these lines were non-planarized (so called because they can be thought of as existing at
two different elevations, or planes). Using both the Integrate tool and the Any Vertex
option had the effect of planarizing these two lines, meaning they are now considered to
meet at the same elevation, thus allowing cars to turn from one street to the other. This is
a good approach if the data was spaghetti-digitized. If, however, the data has properly
resolved intersections, then Tutorial 2 will be of more interest.

11
Tutorial 2. Planarization and elevation fields.
This is the method used by most commercial data providers to prepare data for use with
NA. With this method, lines are physically split wherever they intersect, and the network
dataset is built with the End Point option. You may wish to review Tutorial 1 to
familiarize yourself with the other main approach, and with terms such as planarization,
the End Point option, etc.
1. Start ArcMap with an empty map document.
2. Add a pre-built network dataset to the map.
Click the Add Data button and navigate to the
Tutorial.gdb geodatabase (it should be in the same
folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the planarization feature dataset.
Double-click the planarization_ND network dataset.
Note that this network dataset was created using the default settings.
Click Yes when prompted to add all the feature classes.
Note the data has two intersections: the one to the right has no network junction, which
means these lines are not connected. We will use the Split tool to planarize this
intersection.
Although not required, it is very helpful to have vertices located at all unresolved
intersections.
3. In ArcToolbox, open and run the Integrate tool.
Expand the Data Management Tools toolbox.
Expand the Feature Class toolset.
Double-click the Integrate tool.
Click on the dropdown arrow to the right of Input Features and choose street.
Leave the XY Tolerance parameter blank.
Click OK.
Although the data looks the same after running Integrate, vertices have been added to
both streets at the intersection.
4. Start editing.
5. Set up the snapping environment.
Click Editor, and click Snapping.
Check the box to turn on Vertex
snapping for the street layer.
Leave all other boxes un-checked.
Close the Snapping Environment window.

12

6. Single-click this line to select it.

Note: This is the location we will make two separate


splits at, referred to in Step 7.
Note: This is the horizontal cross street referred to
in Step 8.
7. Click on the Split tool
and then click exactly where the selected line is crossed
by the other street (identified in the figure above).
The selected line will be split into two lines exactly at the intersection because Integrate
added vertices there that are being snapping to. This would be much trickier without
using Integrate.
8. Select the horizontal cross street (see figure, above), and then repeat Step 7 with it.
9. Stop editing and save your edits.
10. Run the Build Entire Network Dataset command.
Notice that a new network junction was added at this
intersection.
Notice also that there are now four separate lines
instead of the two that we started with. This means
the streets have been planarized with the Split tool.
Cars can now turn between these streets, unlike in the
original data.
To make this workflow reasonably efficient, the Integrate tool was used to create vertices
to snap to. The network junctions were also displayed to see which intersections required
work. There are other ways of achieving the same result, and some are much more
efficient (such as using geodatabase topology, or using the Workstation CLEAN
command against an ArcInfo coverage). If you have an ArcEditor or ArcInfo license, you
should investigate these other methods.
Regardless of how the streets are planarized, the real-world overpass/underpass situations
still must be considered. A lot of free data already has been fully planarized, even at
overpass/underpasses. This means the model would allow cars to turn directly between a
freeway and a city street without using any on/off ramps, when in reality, cars would only
travel along on/off ramps to make the maneuver. These intersections need to be unplanarized. Elevation fields will be used to accomplish this.

13
11. Create a new field named f_elev on the street layer.
In ArcToolbox, expand the Data Management Tools toolbox.
Expand the Fields toolset.
Double-click the Add Field tool.
Click on the dropdown arrow to the right of Input Table and select the street
layer.
Type f_elev for the Field Name.
Do not change any other properties.
Click OK.
12. Repeat Step 11, this time adding a field called t_elev.
These two fields can be named anything, but f_elev and t_elev (for from elevation
and to elevation) are widely used by the GIS community, and ESRI software knows
what they are.
13. Change the street layer symbol to show which direction each line is digitized in.
Single-click the line symbol
shown in the ArcMap Table
of Contents under the street
layer.
In the Symbol Selector
window, choose Arrow at
End.
Click OK.
14. Label the streets with the ObjectIDs so that we can tell one street from another.
ObjectIDs in a geodatabase feature class are always unique between different
features.
Double-click the street layer in the
ArcMap Table of Contents.
Click the Labels tab.
Check Label features in this layer.
Set the Label Field to OBJECTID.
Click OK.
Note to shapefile users: the ObjectID field will be called FID.
Each line should now have an arrowhead
indicating the digitized direction, and the
ObjectIDs should be labeled.
We need to prohibit turns between streets 8 or
16 to streets 10 or 17, since this is a real-world
overpass/underpass. We also need to maintain
connectivity between streets 16 and 8 (the

14
overpass), and between streets 17 and 10 (the underpass). Currently, cars can turn all
ways here since there is a network junction that connects all four streets.
15. Start editing.
16. Select street 16 and click the Attributes
button located on the Editor toolbar to see
that the two new fields created earlier both
contain <Null> values (they would be zero
for shapefile users).

The intersection needed to be fixed is where streets 8, 10, 16 and 17 come together. This
is at the to-end of street 16 since it is next to the arrowhead for street 16. Remember, to
in this case means relative to the digitized direction, and the Arrow at End symbol
indicates digitized direction. So the elevation to be edited is at the to-end of street 16.
17. Since we need to change the to-end of the
line, type the number 1 into the t_elev field, and
then press the Enter key on the keyboard.
The actual number does not matter (it
could be any number), but 1 is widely used
by the GIS community for an overpass.
Street 16 is now complete. There is no need to do anything to the from-end of this street
since there is no over/underpass at that intersection, so we will leave the f_elev field for
street 16 <Null>.
Street 8 also needs an elevation of 1 (so
that it will remain connected to street 16),
but should it be set as the from- or toelevation? Look at the arrowhead on street
8 in the diagram to the right, and notice it
is at the opposite end from the intersection
we are working on. That means the f_elev
field must be set to 1.
18. Select street 8, and type in the value 1 for the f_elev field. Do not type anything into
street 8s t_elev field since that end of street 8 is just a regular intersection where cars are
permitted to turn all ways.
The elevation value for streets 10 and 17 need to be set, since they are currently <Null>
for both elevation fields.
19. Select street 10 and set the f_elev field to 0.

15
20. Select street 17 and set its f_elev field to 0.

Again, the actual value does not matter, but both lines must use the same value (since
they are at the same level) and 0 is commonly used for an underpass. A further rule is that
the underpass number must be different from our overpass number. Notice both f_elev
fields were set to 0, and both t_elev fields were left <null>. This is simply because both
of these lines were digitized away from our intersection.
This intersection is now complete, since all four street ends that meet at this intersection
have been assigned an elevation. We do not have to do anything with the elevation fields
at normal intersections, so most values will remain <Null>. This only has to be done
where there are non-planarized intersections.
The tricky part here is to know which of the two elevation fields you have to type into,
and whether to type a 0 or a 1. You will know you made a mistake if cars are still able to
make turns they are not supposed to after re-building the network.
Note to geodatabase users (does not apply to shapefiles): If you have a point feature class
that participates in the network dataset, and if you happen to have points located exactly
at overpass/underpasses (such as a traffic signal) then you must add a field to your point
feature class (call it elev, data type Short Integer) and set this field to be 0 or 1.
21. Stop editing and save the edits.
22. Exit ArcMap.
Click File, and click Exit. Save the .mxd file.
You will not be able to complete the following steps if ArcMap is running.
23. Start ArcCatalog and navigate to the network dataset planarization_ND.
See the selected item in the screenshot from Step 2.

16

24. Select the network dataset and delete it.


Notice the planarization_ND_Junctions feature class is also deleted by ArcGIS
since it is part of the network dataset.
25. Use the New Network Dataset wizard to re-create the network dataset.
Right-click the planarization feature dataset, click New, and click Network
Dataset.
Click the Next button three times to get to the elevation field pane.

Nothing needs to be done here since we used field names that ArcGIS
recognized. If you had used different field names, you would probably have to
fill in this window yourself.
Click the Next button three times, past the attributes panel.
Click Yes to add the cost attribute.
Click Next past the directions panel.
Click Finish to create the network dataset.
Click Yes to build the network.
26. Start ArcMap and open the .mxd file saved in Step 22.
If desired, turn off the labels and the arrows to make the display less cluttered.
27. Create a new Route analysis layer.
On the Network Analyst toolbar, click Network Analyst, then click New Route.

17

28. Add two stops as indicated in the diagram below.


Be sure to add the two stops in the correct order.
29. Click Solve.
NA is able to find a route
between the stops because the
right-hand most intersection
was planarized by splitting
the line features. A route
would not have been found
with the original data.

30. Move stop 2 to the location shown below, and click Solve.

NA can not find a route since the only way to get from stop 1 to stop 2 would be to jump
off the overpass, which is now present due to the elevation fields. A route would have
been found with the original data without the elevation fields.
31. Click the Close button in the pop-up window.
At first glance, it appears that there is only one junction at the left-hand intersection in the
diagram.
32. Use the Network Identify tool on that junction.
The Network Identify window will report that there are actually two coincident junctions
at this point. Each connects to only two streets. In the original data, there was only one
junction at this intersection, and it connected all four streets.
33. Exit ArcMap and ArcCatalog since Tutorial 2 is finished.

18
Summary:
The Split tool (or much more efficient procedures with a higher license, such as using
geodatabase topology, or using the Workstation CLEAN command against an ArcInfo
coverage) can be used to planarize unresolved intersections. Using the End Point
connectivity option in conjunction with elevation fields is the recommended workflow
when you have fully planarized street data. The End Point option is the default, so it does
not have to be specified it in Step 25.

19
Tutorial 3. Adding a drive-time field.
Most free data does not come with a drive-time field. That means NA can only find the
shortest route by distance (i.e. based on the digitized length of your streets) since ArcGIS
automatically adds and uses a length-based cost attribute if no other attribute is specified
(as seen in the previous two tutorials). This meets the needs of many people, but it
ignores the fact that some roads, such as freeways, are faster than others. If it is more
important how long it takes to drive somewhere, as opposed to how far it is, a drive-time
field is more appropriate. Two components are needed to calculate drive time: length and
speed. With both, it is possible to calculate how long it takes to drive each line in the
network.
Length:
All geodatabase line feature classes have a field called Shape_Length, or something
similar, and the values in it are always correct.
If the data is a shapefile, you will have to calculate the length of each street. The subtutorial at the end of Tutorial 3 will step through this procedure.
If the coordinate system uses geographic coordinates (decimal degrees) then you need to
do some extra data processing. This is equally true for shapefile and geodatabase users.
NA will happily use geographic coordinate lengths, but you should not. A decimal
degree is not a valid unit of length, as it can vary based on latitude. A degree of longitude
at the equator is about 62 miles, but is nearly 0 miles at the North Pole. Use
ArcToolboxs Project command to convert the data into UTM, State Plane, or some other
projected coordinate system. The other option is to keep the data in geographic
coordinates and use Calculate Geometry to calculate the lengths based on a projected
coordinate system. This procedure is demonstrated at the very end of the current tutorial,
in a separate sub-tutorial.
Speed:
Start by examining what fields are already present have in the street data. Hopefully,
there is field called speed_limit or something similar. If there is a speed field, then start
from Step 16 of this tutorial.
If not, then look for a field called CFCC, CFCC1 or CFCC2 (it may be called FCC, FCC1
or FCC2). CFCC codes are a widely used classification scheme for roads. For example,
A10 means Primary road with limited access or interstate highway, major category,
while A73 means Alley, road for service vehicles, usually unnamed, located at the rear
of buildings and property. The full table can be accessed at
http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=11966.
These codes provide a shortcut to calculate speed limits. It is common practice to assume
that roads with the same CFCC code have the same speed. For example, all A10 roads
could be assumed to have a speed of 65 mph, while 15 mph could be reasonable for all of
the A73 roads. If there is a CFCC field, start from Step 13 of this tutorial.

20
If there isnt a CFCC field, then either create one, or create a speed field. This can take
weeks or months for a large dataset, so look very carefully to make sure there isnt
already a CFCC or speed field. The following tutorial assumes the worst, with no helpful
fields at all.
1. Start ArcMap with an empty map document.
2. Add a pre-built network dataset to the map.
Click the Add Data button and navigate to the Tutorial.gdb geodatabase (it
should be in the same folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the driveTime feature dataset.
Double-click the driveTime_ND network dataset.
Note that this network dataset was created using the default settings.
Click Yes when prompted to add all the feature classes.
3. Open the attribute table for roads.
Note that there are no speed limit or CFCC fields.
4. On the Network Analyst toolbar, click Network Analyst, and click New Route.
5. Using the Create Network Location Tool, add two stops as shown below, and click
Solve.

In the diagram above, the ObjectIDs for roads are labeled to identify each street (this
labeling step is not necessary -- refer to the diagram above when ObjectIDs are
mentioned).
Roads 1, 2 and 3 are slow city streets, while the curved road to the south is a highway.
The two vertical roads are intermediate-speed connectors. Since there isnt a drive time
field, NA used the digitized length to find the shortest route, even though the highway
path is faster.
6. Turn off the Routes layer (in the Table of Contents) so that it does not display.
We will need a field to hold the CFCC2 codes. CFCC2 codes are a simplified version of
the more detailed CFCC codes.
7. Create a new field named CFCC2 on the roads layer.
In ArcToolbox, expand the Data Management Tools toolbox.
Expand the Fields toolset.
Double-click the Add Field tool.

21
Click on the dropdown arrow to the right of Input Table and select the roads
layer.
Type CFCC2 for the Field Name.
Change the Field Type to TEXT (you may need to scroll up in the list to find it).
Set the Field Length to 2.
Do not change any of the other settings.
Click OK.
8. Start editing.
9. Set the CFCC2 field for all of the slow city streets to A4.
Select from the roads layer all of the slow city streets (ObjectIDs of 1, 2 and 3).
Click the Attributes button on the Editor toolbar.
Within the Attributes window, click roads in the left-hand pane.
This allows you to specify the CFCC2 code for all selected records
simultaneously. This can save lots of time
when editing thousands of records that will all
have the same CFCC code.
In the right-hand pane, type A4 into the CFCC2
field, and press the Enter key on the keyboard.
10. Set the CFCC2 field for the moderate speed streets to A3.
Select the roads with ObjectIDs of 6 and 7.
Click roads in the left-hand pane of the Attributes window.
Set the CFCC2 to A3.
11. Set the CFCC2 field for the highway streets to A2.
Select the roads with ObjectIDs of 5, 8 and 9.
Click roads in the left-hand pane of the Attributes window.
Set the CFCC2 to A2.
12. Stop editing and save the edits.
One shortcut to the above workflow would be to pre-set all CFCC2 codes to A4, using
the ArcMap field calculator. Actually, you would set it to whatever code will be the most
common in your dataset, which for cities is usually A4. You would then only have to use
the ArcMap editor to change streets that have a different value. Alternatively, you could
have used the ArcMap field calculator throughout, and never use the Editor. Finally,
geodatabase users should use default values and domains, especially for large datasets.
Now that our CFCC2 field is fully populated, they can now be converted into speed
limits.
13. Create another field to the roads layer called speed, with the Field Type set to
DOUBLE.

22

14. Use the Field Calculator to calculate the speed field based on a VBA expression.
Open the attribute table for roads.
Right-click the speed field, and click Field Calculator.
Click the Load button.
Double-click the file called Tutorial3.cal (it should be located in the same
folder that this .doc file is in).
A pre-written VBA expression will be loaded.

This code sets the speed field based on the CFCC2 codes. For example, all
A1 freeways will have a speed value of 65 mph, while the A4 city
streets will be set to 25 mph.
The second line of code (speed = 1) will only be used if the CFCC2
value is <Null>. Modify the value to be whatever is appropriate for your
data.

23
15. Click OK to run the Field Calculator.

The attribute table should


now look like the diagram to
the left.

When you are ready to work with your real data, the speed values in the above Select
Case statement should be modified to match your local speed values. In this example, the
freeways and major highways (A1) were set to 65 mph, but in your data it may be lower
or higher. For example, use:
Case "A1"
Speed = 55
for areas with a lower freeway speed limit.
Also, it is not necessary to specifically use CFCC codes. It is possible to use another type
of classification field, since this field is only used to assign speed values. That is why it is
so important to examine the data carefully; there may be an unlikely field that can be
used to calculate speeds. For example, there may be a field called abc that had three
different values: a, b and c, where a = freeways, b = feeder roads, and c = city streets.
One would never guess this from the field name, so be sure to check the metadata
carefully, if it is present. These three categories can be converted to a VBA expression
like the following:
Dim speed As Integer
speed = 1
Select Case [abc]
Case "a"
speed = 65
Case "b"
speed = 45
Case "c"
speed = 25
End Select
As a final option, you could skip road classification codes altogether and just type the
speed limits directly into a speed limit field.

24
16. Create a new field to the roads layer called minutes, with a Field Type of
DOUBLE.
The new field can be named anything, but ArcGIS recognizes a field named minutes,
so it will save time later. It is a good idea to follow naming conventions used by the
ArcGIS community wherever possible, since it means others will be able to use your data
quickly, and fewer people will be asking you questions that can be easily answered in the
data.
The length and speed fields are already populated, so the drive times can now be
calculated. For this tutorial, we want drive time in minutes; although any time unit can be
used. To do this, the correct formula must be used. The basic formula is Length / Speed.
For example, a 30 mile long road with a speed of 60 mph would takes 0.5 hours to drive.
However, such a simple formula is rarely used, since the distance and time units usually
complicate matters. The formula we will use is:
minutes = [SHAPE_Length] / 5280 * 60 / [speed]
Lets examine this in some detail. The data happens to be in State Plane feet, so the
SHAPE_Length field is in feet. But the speed values are in miles per hour. This means
there are two different units of distance: feet versus miles. That is why we have to divide
the length by 5280, so that everything would be in miles. The same logic explains why
we have to multiply by 60 -- the time units are hours for the speeds, but the drive times
are to be reported in minutes.
Any units can be used for the inputs (length and speed) as well as for the output (the drive
time field), but the correct constants must be used. If the constants are wrong, NA will
still find the quickest route (as these are just constants) but the time it reports back will
not be what is expected. Below is an easy workaround for this situation:
Convert all the distance lengths into miles.
o Create a new field, and set it to: feet / 5280.
Convert the speeds to miles per minute.
o Create another new field, and set it to: mph / 60.
For example, 65 mph becomes 1.08333 miles/minute.
Use the basic formula (Length / Speed) for the drive time field.
The basic expression works since all inputs are now in miles and in minutes.
17. Use the Field Calculator to calculate the minutes field based on an expression.
In the attribute table for roads, right-click the minutes field, and click Field
Calculator.
Uncheck the Advanced box.
Delete anything in the minutes = box.
Paste the following expression into the minutes = box:
[SHAPE_Length] / 5280 * 60 / [speed]

Click OK to run the calculator.

25
We now have drive times, in minutes, for all of the roads.
18. Close the attribute table for roads.
The network dataset now needs to be modified, since the current one did not have the
minutes field when it was originally built.
19. Exit ArcMap
Click File, and click Exit. Save the .mxd file.
You will not be able to complete the following steps if ArcMap is running.
20. Start ArcCatalog and navigate to the network dataset driveTime_ND.
21. Create a new Minutes attribute on the network dataset.
Right-click the network dataset and click Properties.
Click the Attributes tab.
It currently only has the default
attribute, which is based on the
digitized lengths of the lines.
Click the Add button and fill in the
Add New Attribute window:
o Type Minutes for the Name.
o Verify that everything else is as
shown to the right.
o Click OK.
Note that no evaluators need to be set manually because the field was called minutes,
so ArcGIS recognized it. If the field had a non-recognized name, then you would have to
click on the Evaluators button and specify the evaluators manually.
You may want to click on the Evaluators button just to see how ArcGIS set the
evaluators for this attribute. Do not make any changes in the Evaluators dialog,
and click Cancel to close the Evaluators dialog.
There are now two Cost attributes in this network, Length and Minutes, so we will have
to tell the system which one ArcMap should be using by default. The network can have
as many Cost attributes needed, but only one can be the default. Currently the default is
the Length attribute, as indicated by the blue default icon. We want to set the default to
the Minutes attribute we just created.

26
22. Right click on the Minutes attribute in
the Network Dataset Properties window, and
click Use By Default.
The blue default icon will move to the
Minutes attribute.
23. Click OK on the Network Dataset
Properties window.
24. Right-click the network dataset and click Build.
You always have to rebuild the network dataset after it has been edited. This is true
whether the edits are to the rows (via the ArcMap Editor) or to the schema (such as
adding a new attribute).
25. Start ArcMap and open the .mxd file saved in Step 19.
Even though the default Cost evaluator was changed in ArcCatalog, this has no effect on
existing map documents. The change is only reflected when adding the network dataset to
a new .mxd file. Since the Route layer in this map was set up to use the Length
attribute, we have to change it to use the new Minutes attribute.
26. Change the Analysis Settings for this Route layer to use the Minutes attribute.
Click the Route Properties button in the NA window
Cick the Analysis Settings tab
Change the Impedance from Length (Feet) to
Minutes (Minutes).
Click OK button.
Note that the terms Cost and Impedance both mean the same thing to NA.
27. Turn the Routes layer back on in
the Table of Contents.
28. Click Solve.
Notice that NA has chosen the route using the highway. Even though this is a longer
route (by distance), it is now the correct one since it has a shorter drive time.
29. Exit ArcMap and ArcCatalog since this tutorial is complete.

27
Sub-tutorial. Adding a length field to a shapefile that is in geographic coordinates.
Using data that is in decimal degrees, this sub-tutorial will generate a length field that is
in meters.
1. Start ArcMap with an empty map document.
2. Add the streets_GCS.shp shapefile to the map (it should be in the same folder that
this .doc file is in).
3. Determine if the data uses
geographic coordinates.
Right-click the
streets_GCS layer in the
Table of Contents, and
click Properties.
In the Layer Properties
dialog, click the Source tab.
Examine the Data Source
window.
For this data, it contains a
geographic coordinate system, and
is not projected.
If the coordinate system for your own data is Undefined or Unknown, then use the
methods described in
http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?id=77&pid=73&topicname=Identif
ying_an_unknown_coordinate_system. Do not proceed further if you see Undefined or
Unknown, until it has been fixed.
4. Click Cancel to close the Layer Properties dialog.

28
5. Change the maps coordinate system to a projected coordinate system.
Right-click Layers in the Table of Contents, and click Properties.
Click the Coordinate System tab
In the Select a coordinate system: box, expand Predefined > Projected
Coordinate Systems > Utm >
Nad 1983.
Click NAD 1983 UTM
Zone 16N.
This coordinate system
was chosen for this data
because the coordinate
system uses meters for a
linear unit, and this data
is specific to Atlanta.
Click OK.
Choose a coordinate system that
makes sense for your study area,
given the desired units. For example,
State Plane would be a common
choice for those wanting distances in
feet, while Albers would be good for
those with a study area
encompassing many states.
Now that we know this data uses geographic coordinates, and have chosen an appropriate
coordinate system in the desired distance units, we can now create a field that will hold
the length of each polyline.
6. Create a new field named meters.
Right-click the streets_GCS layer in the Table of Contents and click Open
Attribute Table.
Click Options > Add Field.
Set the Name to meters and the Type to Double.
Do not change any other settings.
Click OK.
For your own data, name the field the linear unit (e.g., feet) used by the coordinate
system you chose, as NA will automatically know what to do with fields that are named
after linear units.

29

7. Calculate the field with the


lengths based on the coordinate
system.
Right-click the new field
and click Calculate
Geometry.
Verify the settings are the
same as in the diagram to
the right.
Click OK.

This field can now be used with NA since it contains a valid unit of length (meters), even
though the data is still in geographic coordinates (decimal degrees).
The Calculate Geometry command can also calculate in any linear unit. For example, we
could have chosen to calculate in Kilometers [km] instead of meters.
8. Exit ArcMap since this sub-tutorial is complete.
If the geometries of any of the lines are edited or new line features are added, then you
will need to perform Step 7 again, as the length field will not be updated automatically.
Remember to rerun Calculate Geometry whenever the geometry is edited.
If your shapefile data has a projected coordinate system, then you would still do
everything above, except you would skip Step 5 (since the map is already in a projected
coordinate system), and you would choose the first option in Step 7 (Use coordinate
system of the data source).
If you are using a geodatabase that uses geographic coordinates, the procedure is the
same as described above. If your geodatabase uses a projected coordinate system, then
you can skip this sub-tutorial entirely since the Shape_Length field is already in linear
units.

30
Tutorial 4. Making NA respect one-way streets.
This tutorial will demonstrate how to enforce one-way streets.
1. Start ArcMap with an empty map document.
2. Add the theStreets line feature class to the map.
Click the Add Data button and navigate to the Tutorial.gdb geodatabase (it
should be in the same folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the oneWay feature dataset.
Double-click the theStreets feature class.
Note that there is no pre-built network dataset in this data.
Examine the data (see the figure below). The goal is to find the shortest route from the
extreme left side of the feature class
all the way to the extreme right-hand
side. Notice that there are two ways
of doing this, the short top-most route
and the much longer U-shaped lower
route. If a One-way restriction is not
used, the shorter top-most route
would be found by the solver. The
goal is to make the top-most route a one-way street, so the solver will have to go the long
way around, via the lower U-shaped route. The arrow shows the permitted direction of
travel that cars are allowed to take, and that will be set in this tutorial.
Before making any edits, we must first know which way each line is digitized.
3. Symbolize the theStreets layer using the Arrow at End symbol:
Single-click the line symbol shown in the ArcMap Table of Contents under the
theStreets layer.
The Symbol Selector window opens.
Choose the Arrow at End symbol.
Click OK.
Each line is now symbolized with its digitized direction.
In the diagram to the left, the
ObjectIDs for theStreets are also
labeled to identify each street (you
do not have to do this).
4. Create a field to hold the one-way values.
In ArcToolbox, expand the Data Management Tools toolbox.
Expand the Fields toolset.

31
Double-click Add Field tool.
Click on the dropdown arrow to the right of Input Table and select the
theStreets layer.
Type Oneway for the Field Name.
Change the Field Type to TEXT (scroll up to see TEXT).
Set the Field Length to 2.
Do not change any of the other settings.
Click OK.
As usual, this field can be named anything, but Oneway will save work later on, as
noted in previous tutorials, but it really makes a difference for a one-way field since it
avoids having to type in VB code. Be sure to name it Oneway, or one of the other
supported field names listed in Appendix 1 to avoid VB programming.
5. Edit the one-way street to be designated as one-way.
Start an edit session.
Select the line that is to be made a one-way street. In this case, select the line with
OBJECTID = 10.
Click on the Attributes button on the
Editor toolbar.
Type TF into the Oneway field in the
Attributes window, and then press the
Enter key on the keyboard.
For each one-way street, the Oneway field has the value of either FT or TF. Nothing is
in the field for two-way streets. FT means travel is allowed in the digitized direction
(i.e., travel is permitted in the From-To direction, but not the other way). TF means
travel would be permitted only against the digitized direction (i.e. To-From travel is
allowed, but travel would not be allowed in the From-To direction). The goal with this
data is to allow traffic to travel from right to left, and thereby prohibit travel from left to
right. Since the line is digitized from left to right, the value of the Oneway field must be
TF since we are allowing travel only against the digitized direction.
6. Label the Streets feature class with the Oneway field.
The map should look like this:

7. Save the edits and stop editing.


8. Exit ArcMap and save the .mxd file.

32
9. Start ArcCatalog, navigate to Tutorial.gdb and open it.
10. Right-click the oneWay feature dataset, point to New, and click Network Dataset.
11. Click the Next button without changing any settings until you arrive at the Specify
the attributes for the network dataset panel.
Notice that there is already an attribute called Oneway. This is because the field created
earlier was named Oneway, so the software automatically picked it up. The Usage is
Restriction since one-way streets are designed to prevent specific movements.

12. Click the Evaluators button.

33
13. Click on either of the two records in the main window and click on the Evaluator
Properties button (circled in red below) to see the VB Script code ESRI uses by default
for one-way streets:

Do not change anything in here; just click Cancel twice (once each for the Field
Evaluators dialog and for the Evaluators dialog) to get back to the New Network Dataset
window.
14. Click the Next button. A message will appear saying that there must be at least one
cost attribute. Click Yes to create an attribute using the length of the lines as the cost (as
opposed to travel time, for instance).
15. Click the Next button again, and then click Finish. When prompted, click the Yes
button to indicate you want to build the network dataset.
16. Exit ArcCatalog and start ArcMap. Open the .mxd file saved in Step 8.

34
17. Add the oneWay_ND network dataset to the map.
Click Add Data.
Navigate to Tutorial.gdb and double-click it.
Double-click the oneWayfeature dataset.
Double-click the oneWay_ND network dataset.
Click Yes to add all of the feature classes to the map.
18. On the Network Analyst toolbar, click Network Analyst > New Route.
19. On the Network Analyst toolbar, click Show/Hide Network Analyst Window if it is
not already present. In the upper right-hand corner of the Network Analyst Window, click
the tiny button that is circled in red below:

The Layer Properties window will open.


20. Click on the Analysis Settings tab and verify that Oneway is checked in the large
Restrictions box and click OK.
21. On the Network Analyst toolbar, use the Create Network Location Tool to add a
stop all the way to the left of the feature class, and then a second stop all the way to the
right-side of the feature class. Be sure to get the order of the two stops correct.
22. On the Network Analyst toolbar, click the Solve button.

The longer path will be found since the Oneway restriction prohibits the shorter path.
23. On the Network Analyst toolbar, click the Select/Move Network Location Tool, and
then select and delete both stops you placed earlier.
24. Add the same two stops back as you did in step 21, but in the opposite order, i.e. add
the right-hand most stop first, and then add the left-hand most stop.
25. Click the Solve button.

35

This time, the shortest route will be found since travel is allowed from right to left on this
one-way street.
26. Close ArcMap since this tutorial is finished.
Some find using FT and TF confusing. Here is a much simpler way of approaching this,
if you dont mind editing your data. For every one-way street, use the Editors Flip
command to make sure the digitized direction follows the permitted direction of travel,
and then set the Oneway field value to FT. This avoids any possibility of getting FT or
TF confused since only FT will be used (since all of the one-way streets would be
digitized in the direction of travel).
However, if your data already has the four house number fields (FromLeft, etc,) used for
geocoding, then flipping the polyline would mess up geocoding. You will also have to
flip all four house numbers to compensate. There is a tool at
http://arcscripts.esri.com/details.asp?dbid=12808 that will fix the four house number
fields after the line has been flipped.
There are other ways of modeling one-way streets which are not covered here. Some use
a value of -1 with two fields instead of using FT and TF in one field. The FT/TF format
was chosen for use in this tutorial since it is widely used by data vendors.
It is not necessary to use the values of FT and TF; any values can be used. This is
especially useful for those who do not primarily speak English. However, if you do not
use values of FT and TF, then you will have to be capable of editing the VB Script
evaluator. By default, the ESRI evaluator uses the following code for the From-To
direction:
restricted = False
Select Case UCase([Oneway])
Case "N", "TF", "T": restricted = True
End Select
You can substitute your own values instead of using the three default values of "N", "TF"
and "T". For the To-From direction, ESRI uses "N", "FT", and "F", so you will have to
edit this evaluator as well. You would change the values in the Field Evaluators dialog
while building the network dataset, as shown in the diagram in Step 13.
You could also use values of tf or ft instead of TF or FT since NA converts all
values to upper case (using the VB UCase function).

36
Tutorial 5. Using global turns.
So far, turns have been ignored. This is not a very good idea since it means NA will treat
a left-hand turn the same as a right-hand turn, even though left-hand turns in the real
world usually take longer to make than right-hand turns. Later on, Tutorial 6 will describe
another way of dealing with turns that is much more time consuming, but also more
precise. The current tutorial demonstrates a simple way of specifying something like all
u-turns will take 30 seconds, all left turns will take 24 seconds, all right turns will take 12
seconds, and going straight through any intersection will take 6 seconds.
1. Start ArcMap with an empty map document.
2. Add a pre-built network dataset to the map.
Click the Add Data button and navigate to the Tutorial.gdb geodatabase (it
should be in the same folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the globalTurns feature dataset.
Double-click the globalTurns_ND network dataset.
Note that this network dataset was created using the default settings.
Click Yes when prompted to add all the feature classes.
3. On the Network Analyst toolbar, click Network Analyst, and click New Route.
4. Use the Create Network Location Tool to add two stops as below, then click Solve.
At first glance, it might seem as if the
longer route has been chosen, but this
is because the network was built with a
time-based impedance, as opposed to
length. The minutes field for
roadsForGlobalTurns has been
labeled (you do not have to do this). If
you add up the numbers, you will
notice that NA chose the quickest
route -- the route found was 5.5
minutes; the other route would have
been 5.75 minutes. However, the route
found has three left turns, so maybe
this isnt the best route? Remember that NA can only use what it is given, and this
network does not know that left turns take longer than right turns. We will now be adding
global turns to the network dataset.
5. Exit ArcMap (save the .mxd file).
6. Start ArcCatalog, navigate to Tutorial.gdb and open it.

37
7. Open the globalTurns feature dataset.
8. Right-click the network dataset globalTurns_ND and click Properties.
9. Click the Attributes tab and select the Minutes attribute, then click the Evaluators
button.
10. Click the Default Values tab.
Notice the Element called Turn. These are the global turns that you get when you
create a default network dataset with the New Network Dataset wizard (shown in the lefthand figure below).

11. Change the evaluator Type property of Turn to VB Script, and click the Evaluator
Properties button.
The Script Evaluators window that opens allows us to type code that specifies how much
of a delay turns have. If Constant instead of VB Script was selected for the evaluator
type, we can specify that all turns have a delay of 15 seconds (or any other amount of
delay). The VB Script evaluator allows us to be more sophisticated and specify that left
turns are slower than right turns. Use the VB Script evaluator to model conditional
delays.
12. Click the Load button and double-click Tutorial5.sev (it should be located in the
same folder that this .doc file is in).
The pre-written VB code will be loaded.

38

The variable turnTime


must be in minutes (turns and
edges need to be in the same
units, and this impedance
attribute is in minutes).
This code specifies that all
left turns to be 24 seconds
(which is 0.4 minutes), all
right turns are 12 seconds, all
straight-aheads are 6
seconds, and all U-turns are
30 seconds.
Turn.Angle is
something NA creates
automatically, and is used
here to define a left turn as
any time two lines connect to
each other with an angle of
between 210 and 330
degrees. You can use any
angle values that make sense
for your data -- just be sure
the ranges do not overlap one
another.
The code sets up four different turn categories (left vs. straight vs. right vs. U-turns) but
the code can be modified to use a different number of categories. For example, the
document at
http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=29536
demonstrates penalizing only left turns, and ignores the other three types, meaning right
turns, etc. are free. This same document also explains Turn.Angle in more detail.
13. Click OK three times (once each for the Script Evalutors dialog, the Evaluators
dialog, and the Network Dataset Properties dialog).
14. Right-click the network dataset globalTurns_ND and click Build.
Remember that the network needs to be re-built any time an attribute is changed.
15. Start ArcMap and open the .mxd file you saved in Step 5.

39
16. Click Solve.
NA now chooses the other available route.

17. Open the attribute table for the output Routes feature class (be careful, this is
different from Route).
Notice that the time for the route is 6.55 minutes. This is the time for the four edges (1.5
+ 1.75 + 1 + 1.5 = 5.75 minutes) plus one left turn (0.4 minutes) plus two right turns (at
0.2 = 0.4 minutes).
Your time may be slightly different if you did not locate the two stops exactly at the
very end of both lines.
18. Close the attribute table.
19. Place a barrier on the 1.75 edge and Solve again.
The original route (which was 5.5 minutes in Step 4) is now 6.8 minutes since there is
now three left turns and one straight-ahead turn. This is why the result of Step 16 is now
a different route than before.
Unfortunately, there is no way to visualize global turn delays on a map, as a typical 4way intersection has 16 possible turns counting U-turns -- we have to count each turn
manually when analyzing the results.
20. Exit ArcMap and ArcCatalog since this tutorial is finished.

40
Tutorial 6. Digitizing turn features.
In Tutorial 5, global turns were used. This tutorial will demonstrate creating turn features
for specific intersections. There are two reasons to do this. First, it can take longer to turn
at one intersection than at another, and individual turn features can model this -- these are
called delay turns, because it tells NA that you can turn here, but there is a cost associated
with doing so. Secondly, turn features can be used to prohibit certain turns altogether -these are called restricted turns. This tutorial will cover both uses.
Turn features should not be used to prohibit turning on to one-way streets. Instead, set up
a one-way field to deal with one-way streets, which was covered in Tutorial 4. Make
restricted turns only to restrict turns beyond the one-way restriction.
1. Start ArcCatalog and navigate to the line feature class for this tutorial.
Navigate ArcCatalog to the Tutorial.gdb geodatabase (it should be in the same
folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the digitizedTurns feature dataset.
Click the theRoads feature class.
Note that there is no pre-built network dataset in this data.
2. Click the Preview tab, and change the Preview dropdown list to Table.
Notice that there is already a one-way field (oneway) and a cost field (minutes)
added to this feature class and fully populated, as per the instructions in Tutorials 3 and 4.
3. Change the Preview dropdown list to Geography.
Notice there are several divided highways, which have been modeled as one-way streets.
These divided highways have been included into this tutorial exercise, as they can cause a
lot of confusion when creating turn features.
4. Click the Contents tab in ArcCatalog.
5. Right-click the digitizedTurns feature dataset, point to New, and click Network
Dataset.
6. Click Next five times to get to the Attributes panel of the New Network Dataset
wizard.
Notice that NA automatically created both the Oneway and Minutes network
attributes (from the oneway and minutes fields, as they used field names that it
would recognize).
7. Click Next two more times, then click Finish to create the network dataset. When
prompted to build it, click Yes.

41

ArcView 3.x and Workstation both used flat (non-spatial) tables to store turns. ArcGIS
takes a very different approach: it uses a spatial feature class.
8. Create a new turn feature class.
Right click the digitizedTurns feature dataset (not the network dataset), point to
New, and click Feature Class.
On the first panel, set the Name to
theTurns, and change the Type to
Turn Features; do not change
anything else.
Click Next.
On the second panel, accept the default
settings.
Click Next.
On the third panel, inspect the fields
that ESRI already added to this feature
class.
These fields contain all of the properties that define a turn feature. Because
turns are a special feature class, ESRI will automatically populate these fields
when creating individual turn features (which we will do later using the
ArcMap Editor).
Scroll down to the end of the fields and add a new field called minutes, and set its
Data Type to Double.
This field will indicate the turn delays.
Add a second field called
Traversable, set its Type
to Text, and give it a
Length of 1.
This field determines
whether a turn feature
is a delay turn (in which
case the value will be Y
(for Yes) as delay turns
can be traversed) or a
prohibited turn (N for
No, since they are not
allowed to be traveled).
Click Finish.
Note that we didnt build the network dataset yet, since no turns have yet to be added.
We could build it now, but we would need to build it again after creating the turn
features.

42
9. Modify the network dataset so that it makes use of the new fields.
Right-click digitizedTurns_ND and click Properties.
Click the Attributes tab.
Select Minutes under the Name property and click the Evaluators button.
Select the record where Source = theTurns.
Change the Type to Field.

Notice that NA automatically sets the Value to the correct field (because of its
name).
Click OK to close the Evaluators window.
This is all that needs to be done to set up a delay turn. However, a restriction attribute
must also be set up since some of these turns will be prohibited.
10. Create a new restriction attribute.
Click the Add button.
Set the Name to Traversable.
Set the Usage Type to
Restriction.
Click OK.
11. Set the evaluators on the new Traversable attribute.
Select the Traversable attribute and click the Evaluators button.
Select the record where the Source is theTurns.
Set the Type to Field and click the Evaluator Properties button.
Click the Load button and double-click Tutorial6.fev.
The prewritten VB code will be loaded.

43
In the VB code, [Traversable]
refers to the field that was created in Step
8. A value of N (for No) in this field
means that travel is prohibited. That
means this VB code must return True to
restrict travel. In other words, if the
Traversable field says N, then the
variable in the VB code called
restricted will be True and cars
cannot travel through this turn. For all
other values besides N, travel would be
allowed.

12. Click OK three times (once each for the Field Evalutors dialog, the Evaluators dialog,
and the Network Dataset Properties dialog).
13. Build the digitizedTurns_ND network dataset.
14. Exit ArcCatalog.
15. Start ArcMap with an empty map document.
16. Add the digitizedTurns_ND network dataset to the map.
Click the Add Data button and navigate to the Tutorial.gdb geodatabase (it
should be in the same folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the digitizedTurns feature dataset.
Double-click the digitizedTurns_ND network dataset.
Click Yes when prompted to add all the feature classes.
17. Zoom in until the data fills the canvas.
Notice there are four intersections in this dataset.
18. Zoom into the lower-right intersection.
If you label the ObjectIDs of theRoads
feature class, the intersection should look like
the figure to the right.

44
We would like to model a delay from street 34 turning left onto street 35, since this
intersection is a busy crossroad. Cars will still be allowed to make this turn, but there will
be a 45 second penalty imposed.
Note that a car would not be able to turn left from street 34 onto street 37 since the
oneway attribute prevents this.
19. Prepare the Editor for creating a new turn feature.
Start Editing.
On the Editor toolbar, click Editor, and click Snapping.
Turn on snapping only for Edge for theRoads.
It is critical to use snapping when making turns.
On the Editor toolbar, set the Target layer to theTurns.
Make sure the Task is set to Create New Feature.
Click on the Sketch Tool (the pencil tool).
Each turn requires a minimum of two points to be digitized. The first point must be the
first street encountered by a car driving the turn. In this case, this is street 34. The final
point must be the last street encountered by a car driving the turn. In this case, this is
street 35.
20. Create the turn feature with two vertices.
Click once (using the left mouse button) on the first street (street 34) to create the
first vertex. Be sure that it is snapped to the street.
This vertex is shown in red in the diagram.
Move the mouse to the upper-left until it is
snapping to the destination street (street 35).
The diagram to the right shows the Snap
Tip.
Double-click on street 35 to finish sketching
the turn feature. Be sure that it is snapped
before double-clicking.
The error message shown to the left will
occur because streets 34 and 35 are not
adjacent to one another. Notice that
street 36 is the block that connects both
34 and 35, so it needs to be included in
the turn feature.
21. Click OK to close the error message.
22. Open the attribute table for theTurns and delete any rows you see.
The editor may not delete the invalid turn that was just made.
Lets try it again, and create the turn feature with all three streets.

45

23. Create the turn feature with three vertices.


Click on street 34.
Click on street 36.
Double-click on street 35.
Be sure to snap properly to all three
streets.
Aside from snapping, it does not matter where exactly you click along each street -- you
could have clicked closer or further from the intersection. If you plan on displaying the
turns in the map, you will want to make them large enough to see at whatever map
scale(s) you intend to work at.
24. On the Editor toolbar, change the Edit Task to Modify Feature.
Notice the turn feature we created looks like any other line feature.
25. Change the Edit Task back to Create New Feature.
Note that we could have also have set up snapping to the network junctions (feature class
digitizedTurns_ND_Junctions, in this network) and added another vertex at the
junction at the north-end of block 36, before finishing on street 35. Some prefer this look,
but it makes no difference to NA. Many never display the turn features anyway.
26. With the new turn feature is still selected,
click the Attributes button on the Editor toolbar.
Note that NA has automatically filled in all of the
required fields (these begin with Edge).
Examine these required fields carefully.
The fields that were created in Step 8 must still be filled in manually.
27. Scroll down in the Attributes window and type 0.75 into the minutes field (the
delay is 45 seconds, but the impedance is in minutes); and type Y into the Traversable
field, since cars are allowed to make this turn (i.e., it is not a prohibited turn).
Actually, there is no need to type Y since the VB code loaded in Step 11 only checks
for N. Some like to enter this information so that there arent any <Null> values.
28. Stop editing and save the edits.
29. On the Network Analyst toolbar, click the Build Entire Network Dataset button.
Remember, the new turn will not be recognized by NA until the network dataset is
built.
The turn will draw as a blue line with an arrow after the network dataset has been built.

46
30. Zoom out until all of the streets can be seen.
31. Solve a route on the network:
On the Network Analyst toolbar, click Network Analyst, and click New Route.
Use the Create Network Location Tool to create two stops as shown below (leftside diagram). Be sure to get the order of the two stops correct.
Click the Solve button.

To really understand these results, compare the results to the exact same Solve if it was
performed right after Step 7 of this tutorial (i.e. before we made the turn feature class), as
shown in the results above in the right-hand diagram. Without the new turn the fastest
route was via streets 35 and 20, based on all turns having a delay of 0. After a 45 second
delay was added going left onto street 35, it is now quicker to take streets 32 and 39. Note
that it is still legal to turn on to street 35, but it is now slower.
32. Place a barrier on street 32 and re-Solve the analysis.
The route will take streets 35 and 20, but the Total_Minutes field in the output
Routes feature class will take into account the turn delay.
33. Delete the barrier added in Step 32, and the two stops added in Step 31.
This concludes the section on delay turns, and will move on to the section on prohibited
turns.
34. Zoom in to the intersection at the lower-left corner of the dataset.
Here there are two divided highways intersecting.
There are no overpasses or underpasses here -- just
stop lights.
35. Create two new stops in the order shown, and
click Solve.
If you turn on ObjectID labels, your screen
should look like the diagram to the right.

47
We want to prohibit a U-turn from street 18 to street 17. Notice that NA did not take
street 29 (which would be shorter) since the one-way restriction will not allow it.
36. Turn off the Routes layer.
37. Start Editing.
38. Prepare the Editor for creating a new turn feature.
Verify the snapping is still turned on for Edge in the theRoads layer.
Set the Target layer to theTurns.
Make sure the Task is set to Create New Feature.
Click on the Sketch Tool.
Streets 21, 28 and 31 are all called interior edges because they are
inside the intersection. The turn feature we will create will have to
reference all three of these interior edges, as well as the two exterior
edges 18 and 17.
39. Digitize the new turn by clicking on edges 18, 21, 28, 31 and 17,
in that order (see diagram to left). Be sure to double-click on the last
(fifth) vertex to finish the turn feature.
It is not necessary to set a delay time for this new turn feature since this is a prohibited
turn.
40. In the Attributes window, leave minutes at <Null> but change Traversable to N,
which means this turn can not be traveled on.
41. Stop editing and save the edits.
42. Run Build Entire Network Dataset.
43. Turn the Routes layer back on.
Before the route can honor the new turn restriction, it needs to be activated.
44. Open the Route Properties and click on the Analysis Settings tab.
Check on Traversable in the Restrictions window (if it is not already
turned on) and click OK.
45. Click Solve.
Notice that the route no longer does a U-turn, but instead it does
something legal, but strange: it travels from street 18 to 21 to 28 to 31,
then jumps on to 29 (since this one-way street is going the correct way),
and then back on to 21, 28 and 31 again, and finally, on to 17. It is all

48
perfectly legal with respect to the turn feature at this intersection, but it is not what is
expected.
One might think the solution here is to make a smaller turn that prohibits movement
between street 31 and street 29.
46. Create a turn feature as shown to the right.
Start editing.
Digitize a turn from street 31 to street 29.
In the Attributes window, set its Traversable field to N.
Stop editing and save the edits.
47. Rebuild the network dataset.
There is a build error.
48. Click the Show Build Errors button.
For the turn created in Step 46, there is the message:
SourceName: theTurns, ObjectID: 4, The edges of the turn element conflict with
existing interior/exterior edges.
This is a common message, which is why this tutorial is demonstrating it. This message
means that once a turn uses an edge as an interior edge to itself, that edge must be used
only as an interior edge by other turns (i.e., no other turn is allowed to use it as an
exterior edge). Edge 31 is already used by the first turn as an interior edge, so the new
short turn cannot use it since it would be used as an exterior edge.
49. Close BuildErrors.txt and click Close on the Network Dataset Build Errors dialog.
50. Start Editing. Delete the new small turn feature created in Step 46, but keep the Uturn feature created in Step 39.
Here is the rule that has been overlooked: U-turns at divided highways should always be
made in pairs, even if only one U-turn is desired.
51. Digitize a new turn feature by clicking on edges 30, 31, 29, 21 and 20, in that order.
52. Since this turn is not prohibited (remember, this turn is only being created since turns
at divided highways should be in pairs) set the Traversable field = Y in the Attributes
window.
53. Stop Editing and save the edits.
54. Build the network dataset.
55. Solve the analysis.

49
The route will now go way up to the north before turning at
a different intersection and coming back, as expected (see
the diagram to the left).
56. Move the two stops as shown in the diagram to the
right.
57. Solve the analysis.
Notice the route will not have to take a long route since the
second U-turn is traversable. Even though this second Uturn does not restrict or delay any travel, it had to be made
so that NA could interpret the first U-turn correctly.
58. Close ArcMap since this is the end of Tutorial 6.
If you will be modeling only delay turns, you do not need to add the Traversable field.
Just add the minutes field in Step 8. On the other hand, if you will be modeling only
prohibited turns, then you should not add the minutes field in Step 8.

50
Tutorial 7. A parameter-based restriction.
Imagine having bridges that have weight or height limits. For example, one bridge may
not be safe for trucks heavier than five tons, but another bridge may be able to easily
handle a heavier vehicle. It is easy to store this information in a field, such as
weight_limit, for the bridge feature class. But the following is a more difficult problem:
imagine also having trucks of different weights. To deal with this, we would have to be
able to specify what the current truck weighs right before solving the analysis. We would
be asking What is the best route for a 2.5 ton truck?, which could give a very different
route than if we had asked What is the best route for a 10 ton truck?. Vehicle weight in
this case is a variable that cannot be put into any field, as it can be changed immediately
before solving the analysis. Parameters allow variables, such as vehicle weight, that can
be specified and changed in ArcMap immediately before performing an analysis.
1. Start ArcCatalog and navigate to the line feature classes for this tutorial.
Navigate ArcCatalog to the Tutorial.gdb geodatabase (it should be in the same
folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the weightRestriction feature dataset.
Note that there is no pre-built network dataset in this data.
2. Inspect the two feature classes in the weightRestriction feature dataset: bridges
and highways. The former has a field called weight_limit (Field Type = DOUBLE).
Preview the Table of the bridges feature class. Notice there is a different weight limit
for each of the three bridges.
The bridges are in a separate feature class from the rest of the roads, but that is not
essential.
3. Right-click the weightRestriction feature dataset, point to New, and click Network
Dataset.
4. Click the Next button once.
5. Click the Select All button to select both feature classes, and click Next four more
times to get to the attributes window.
As usual, the Attributes panel is where most of the action happens, and setting up a
parameter-based restriction is more involved than creating the attributes we set up in
previous tutorials. Be very careful in the following steps to type names exactly as
described. If anything is misspelled, the tutorial will not work.

51
6. Create a descriptor attribute that indicates the maximum weight of each road.
Click the Add button.
Set the Name property to
maxWeight.
Set the Usage Type to
Descriptor.
Set the Data Type to
Double (because the
weight_limit field was
defined as Double).
Click OK.
7. Set up the evaluators for this new descriptor attribute.
Click the Evaluators button
Select the two records where Source = bridges.
Right-click anywhere in the selected area and choose Type > Field.
Right-click in the same area and choose Value > WEIGHT_LIMIT.
Click OK.
The descriptor attribute does not do much by itself (since the Restriction attribute really is
of interest), but it provides a way to point to the weight_limit field, and it will be
eventually tied in to the restriction.
8. Create the restriction attribute.
Click Add on the New
Network Dataset wizard.
Set the Name to Weight.
Set the Usage Type to
Restriction.
Click OK.
9. Create the parameter for the restriction attribute.
Be sure that the new Weight attribute is selected.
Click the Parameters button.
Click the Add button in the Weight Parameters window.
Type Vehicle Weight for the Name.
The names of the parameters should be carefully considered, since these
names are what is shown in ArcMap.
Do not change any other properties, as they are already set correctly.
Having the Type set to Double makes sense for us since a truck can weigh
2.678 tons, for example. It also makes sense as our weight limit field in our
bridge feature class is also Double. The Default Value should be set to the
most common vehicle weight that will be used. For example, if most of your
trucks are five tons, then set the Default Value to 5. In this tutorial, we used 0
because to model solving mostly for cars. The weight of 0 represents a car

52
since a car can travel over any bridge. This allows for us in ArcMap to only
have to type in a weight for heavier vehicles.
Click OK twice (once each for the Add Parameter window and the Weight
Parameters window) to get back to the New Network Dataset window.
We now need to tell NA that a vehicle cannot travel on a bridge if its weight is greater
than the bridges weight limit. This is a conditional test, so it will require some VB code.
10. Set up the evaluators for the restriction attribute.
Make sure the Weight attribute is selected, and click the Evaluators button.
Select the two records where Source = bridges.
Right-click anywhere in the selected area and choose Type > VB Script.
Right-click again in the same area and choose Value > Properties.
Click the Load button and then double-click the Tutorial7.sev file, to add some
prewritten VB code.

The main variable in this code is restricted. If it ends up being set to True,
then that means travel is not allowed on that bridge because the vehicle is too
heavy. The variable weight is the current vehicles weight. It is also the value
that will be typed in ArcMap right before solving. The variable maxWeight is
the weight limit for the current bridge. If necessary, NA will examine each
bridges weight limit (the Edge. means the single bridge currently being
evaluated). The heart of the logic is weight > maxWeight. If the vehicle

53
weight (weight) is greater than the current bridges weight limit
(maxWeight), then this code will return True. Since this is for a Restriction
attribute, True means that bridge is restricted. That means NA will have to find a
different route that does not use this bridge.
Click OK twice (once each for the Script Evaluators dialog and the Evaluators
dialog).
The restriction attribute is now complete.
11. Finish creating the network dataset.
Click Next.
Click Yes to create the required length-based Cost attribute.
Click Next.
Click Finish
Click Yes to build the network dataset.
12. Start ArcMap with an empty map document.
13. Add the weightRestriction_ND network dataset to the map.
Click the Add Data button and navigate to the Tutorial.gdb geodatabase (it
should be in the same folder that this .doc file is in).
Double-click the Tutorial.gdb geodatabase.
Double-click the weightRestriction feature dataset.
Double-click the weightRestriction_ND network dataset.
Click Yes when prompted to add all the feature classes.
14. Make the bridges feature class a different symbol.
The diagrams below show them with the railroad symbol. Those diagrams are
also labeled with the weight_limit field, indicating the maximum allowable
vehicle weight for each bridge.
15. Perform a Route analysis.
On the Network Analyst toolbar, click Network Analyst, then click New Route.
Use the Create Network Location Tool to add two stops as shown in the diagram
below.
Click Solve.

54

NA found the shortest possible route (remember that the Cost attribute for this network is
based on Shape_Length). However, since a vehicle weight was not specified, and the
default vehicle weight for the parameter was set to 0, this is the best route when driving a
car.
16. Modify the Route analysis for a 5-ton truck.
Click Route Properties.
Click the Attribute Parameters tab.
This is where we specify vehicle weight.
Type 5 into the Value property of the Vehicle Weight parameter.
Click OK.

Click Solve.

A different route was chosen. The vehicle (the 5-ton truck) is now too heavy to travel
across the 2.5 ton bridge, so it had to take a longer route.

55
17. Repeat Step 16, this time specifying a Vehicle Weight of 10 tons. NA will now
choose the longest possible route.
18. Finally, solve using the Vehicle Weight set to 15 tons.
You will get the Error No solution found, since none of the bridges can handle a truck
this heavy.
19. Close ArcMap and ArcCatalog since this tutorial is finished.
You can have as many parameters as you need (such as vehicle height and width, as well
as vehicle weight), but you will need to be a capable VB programmer if you would like to
model a complex problem.

56
Appendix 1. Good field names to use.
As has been demonstrated repeatedly in this tutorial, life is easier if fields are called
certain names. That way, ESRI will look for them when creating a network dataset, and it
will automatically turn them into valid network attributes. This is, at the very least, a nice
convenience and, as seen with one-way streets, it can also save you from typing in VB
code. Below is a list of the more common fields NA looks for (case does not matter, so
Oneway is the same as OnEwAy etc.):
One-way field can be called oneway, one_way, dirtravel, dir_travel, traveldir, or
travel_dir. The fields DataType must be String (Text).
Time-based Cost fields can be called minutes, seconds, hours, or days. DataType
must be Double.
Distance-based Cost fields can be called meters, inches, feet, yards, miles,
nautical miles, millimeters, centimeters, kilometers, or decimeters. DataType
must be Double.
There is also a generic Cost field. It must be called cost, DataType Double. The
Units will be set to esriNAUUnknown. Use this if the Cost field units are
something not listed above, such as dollars or degrees Fahrenheit or milliseconds.
Elevation fields (always paired) can be called f_elev/t_elev, f_zlev/t_zlev,
fnode_elev /tnode_elev, or fnode_zlev /tnode_zlev.
For driving directions, the street name field can be called addr_sn, fname, fename,
st_nm_base, street-name, street_name, street_nam, streetname, st_name, st-name,
str_name, str-name, name, street, roadname, or road.
The above list is not complete. Examine the file NetworkDatasetConfiguration.xml to see
the full list. It lists the other components for driving directions, such as prefix direction,
street type etc., as well as several lesser-used attributes specified in this file that NA can
set up automatically. It is located in the ArcGIS install directory under:
\ArcGIS\NetworkAnalyst\NetworkConfiguration\
For example, if you accepted the default installation location, the file will be located at:
C:\Program Files\ArcGIS\NetworkAnalyst\NetworkConfiguration\
The file can be opened in Internet Explorer or by double-clicking it in Windows
Explorer.
Note that this XML file can also be edited to add your own fields etc., but this will
require knowledge of XML. Be sure to make a backup copy of this file before modifying
it. Note that modifications to this file are not supported by ESRI Technical Support.

You might also like