Zusammenfassung
Creates a feature class of route lines on the map and corresponding text directions generated by solving a network analysis layer. The output can be modified using the StreetDirectionProperties object of the network analysis layer.
Diskussion
The Network Analyst Route, Vehicle Routing Problem, and Closest Facility solvers produce on-street routes as output and offer the option of creating turn-by-turn text directions describing those routes. GenerateDirectionsFeatures allows you to produce those text directions as a feature class that pairs each piece of the text direction with a corresponding line feature on the map.
You can modify the output of the directions, such as the language, style, and units, using the StreetDirectionProperties settings on the network analysis layer.
Directions can only be generated from network analysis layers of type route, vehicle routing problem, or closest facility because only these layer types support routes and directions. Additionally, the network dataset used by the analysis layer must be configured for directions.
Syntax
GenerateDirectionsFeatures (network_analyst_layer, {catalog_path}, {schema_only}, {configuration_keyword})
Parameter | Erläuterung | Datentyp |
network_analyst_layer | A network analysis layer object or layer name. The analysis layer solver type must be route, vehicle routing problem, or closest facility because directions support is required. The network dataset used by the analysis layer must be configured for directions. Vorsicht:This function does not support last mile delivery analysis layers even though this layer type supports directions. | Layer |
catalog_path | The catalog path to the output directions feature class. (Der Standardwert ist in_memory\Directions) | String |
schema_only | Specifies whether an empty directions feature class will be generated or if it will also be populated with direction features. (Der Standardwert ist False) | Boolean |
configuration_keyword | The configuration keyword of the output directions feature class. (Der Standardwert ist None) | String |
Datentyp | Erläuterung |
String | The catalog path to the output directions feature class. |
Codebeispiel
Get a route layer object and generate directions from it.
#Get the route layer object from a layer named "Route" in the map
doc = arcpy.mp.ArcGISProject('current')
map_obj = doc.listMaps()[0]
rt_layer = map_obj.listLayers('Route')[0]
#Generate directions features and save them to disk.
arcpy.na.GenerateDirectionsFeatures(rt_layer,
'C:/Data/Directions.gdb/RouteDirections')