Creates a shortest route between given points on a street network and generates driving directions in a text or HTML file.
A shortest route between the user-specified points based on the travel time. An HTML or text file (depending on the task used) containing driving directions.
Uses a street network dataset for the San Francisco area provided in the ToolData folder.
Demonstrates how to reuse an existing Route network analysis layer each time the task is executed. Calculate Shortest Route and HTML Directions task—How an external Python library can be used from a script tool to convert driving directions from XML to HTML format.
C:arcgisArcTutorGP Service ExamplesShortestRoute contains the completed models, script tool, and data.
ShortestRouteService, created in this example, shows you how to publish geoprocessing tasks that calculate the shortest route on a street network between user-specified points and generate a file containing the driving directions. The Calculate Shortest Route and Text Directions task generates driving directions in a text file whereas the Calculate Shortest Route and HTML Directions task generates driving directions in an HTML file. Both the tasks also output the shortest route as a feature set.
The data for this example comes from C:arcgisArcTutorGP Service ExamplesShortestRoute.
The ToolData folder contains a file geodatabase, SanFrancisco.gdb. This geodatabase contains a network dataset, Streets_ND, within the Transportation feature dataset. This network dataset models the street network for the San Francisco area. It provides a network attribute, TravelTime, which indicates the time taken to travel each street segment in minutes.
The basemap layer within SanFranciscoBaseMap.mxd has a layer, Streets, as illustrated below. This layer shows the extent of the network dataset. This means that this task can be used to determine the shortest route only in this extent.
The toolbox for the geoprocessing service is ShortestRouteService, and the source map document for the service is ShortestRouteService.mxd. ShortestRouteService contains two models and a script tool, Convert directions to HTML. This script tool is used within the Calculate Shortest Route and HTML Directions model. ShortestRouteService.mxd contains two source data layers, Streets_ND (the network dataset) and Route (the network analysis layer).
The Calculate Shortest Route and Text Directions model is illustrated below. There is one input parameter, Input Stops, which is points. The shortest route visits the stops based on the digitized sequence. The model adds the user-digitized points as stops to an existing Route network analysis layer, performs a solve to determine the shortest route, generates driving directions, and writes them to a text file.
In this model, a network analysis layer is not created in the model as it is in the DriveTimePolygonsService example. Instead, the existing route layer, Route, is used. (This layer was created using the Make Route Layer tool.) The existing layer can be used because none of the analysis properties for the route layer, such as impedance attribute, are exposed as model parameters. In the DriveTimePolygonsService example, the default break values (an analysis property for service area layers) was exposed as a model parameter, so the Make Service Area Layer tool was required as a model process.
Note that if any of the route analysis properties, such as impedance attribute, are to be exposed as model parameters, the Make Route Layer tool has to be used as a first process in the model.
The Route layer used as an input variable in the model was created by first adding the Streets_ND network dataset to the ShortestRouteService.mxd, then using the Make Route Layer tool. For this example, the following parameters were used for the Make Route Layer tool. Default values were used for the parameters not mentioned in this table.
The Add Locations tool adds user-digitized points as stops to the route layer. The Input Locations parameter for the tool is specified through a model parameter, Input Stops. This parameter is a feature set data type. The schema and symbology for the feature set are derived from the InputStops.lyr file found within the ToolData folder.
The schema for the Input Stops feature set contains a text field, Name. This field can be used to provide stop names while generating driving directions by mapping the Name property to the name field in Field mappings, as illustrated below. If the value for the name field is not specified by the user, default values of Location 1, Location 2, and so on, are used for stop names.
Since the same route layer is used for each model run, any existing stops need to be removed before adding the new stops. To delete existing stops, the Append to existing locations option, illustrated below, is unchecked.
|news||foxnews||accommodations||advance auto||old navy|
|one piece 364||apple||pedo||online public||arkansas mesothelioma|
|geometric shapes||phantom of||pocket pc||guitar amplifier||green day|
|best buy||progressive||ralph lauren||bibliography||bridal shower|
|realtor||hsbc||san francisco||candice walker||car sale|
|sell annuity||kelley blue||kazaa lite||jaramae||ceiling fan|
|luau||letter of||comedy||land rover||computers|
|master of||superstore||symptoms vicodin||toronto mapquest||tagalog poems|
|member web||uk||domai||mesothelioma lawyer||mob nickname|
|video camera||vipzax||educational technology||eden prairie||musicians|