This sample shows how to utilize the StreetMap routing application programming interface (API). It is an implementation of a simple dialog box allowing you to set from and to stop addresses along with other routing settings, such as calculate a route, display route geometry on the map, and display driving directions text.
Language: C#, VB Subject: Geocoding Organization: Esri, http://www.esri.com Date: 11/17/2017 ArcObjects SDK: 10.6 Visual Studio: 2015, 2017 .NET Target Framework: 4.5
- ArcObjects .NET API Reference online
- Sample Data Download
- What's new
- Download the ArcObjects SDK for .Net from MyEsri.com
- Open the solution file in Visual Studio and build the project.
- Start ArcMap.
- Click the Customize menu, click Toolbars, and click Routing Sample to enable the Routing Sample toolbar.
- Click the button on the Routing Sample toolbar to open the Routing Sample dialog box.
- Browse to the location of a routing service file (.rs extension) and select it in the Routing Service field.
- Browse to the location of an address locator file and select it in the Address Locator field.
- Type the address of the starting location for driving directions in the Start section and the address of the ending location in the Finish section.
- In the Options section, specify the type of route, quickest or shortest, to be calculated. Specify the distance units and select the street type preference for routing using the slider bar; for example, moving the slider towards Use Local Roads causes the router to utilize non-highway roads as much as possible in the output driving directions.
- Optional. Click the Restrictions button to open the Restrictions dialog box. If the data referenced by the routing service file specified in step 5 contains restriction attributes, this dialog box will be populated with the available restriction parameters. Set the restrictions in this dialog box as desired.
- Optional. If a point feature class containing barrier features is available, browse to it in the Barriers Table field.
- Click the Find Route button to generate a list of driving directions and display a route graphic in ArcMap.
- Click the Show Directions button to open the Driving Directions dialog box, which contains the list of driving directions.
|Development licensing||Deployment licensing|
|ArcGIS Desktop Basic||ArcGIS Desktop Basic|
|ArcGIS Desktop Standard||ArcGIS Desktop Standard|
|ArcGIS Desktop Advanced||ArcGIS Desktop Advanced|