摘要
在通过求解网络分析图层而生成的地图及相应的文本方向上创建路径线的要素类。可使用网络分析图层的 StreetDirectionProperties 对象来修改输出。
讨论
网络分析路径、车辆配送和最近设施点求解程序生成街道路径作为输出,并可有选择地创建描述这些路径的转弯指示文本方向。GenerateDirectionsFeatures 允许您生成这些文本方向,作为与地图上含相应线要素的每一段文本方向相配对的要素类。
可使用网络分析图层上的 StreetDirectionProperties 设置来修改方向的输出,例如语言、样式和单位。
只能通过类型为路径、车辆配送或最近设施点的网络分析图层来生成方向,因为只有这些图层类型支持路径和方向。此外,分析图层使用的网络数据集必须配置为方向。
语法
GenerateDirectionsFeatures (network_analyst_layer, {catalog_path}, {schema_only}, {configuration_keyword})
参数 | 说明 | 数据类型 |
network_analyst_layer | A variable that references a Layer object obtained from a network analysis layer. It can be derived from existing layers in a map document or by specifying the catalog path to the network analysis layer file as an argument to the Layer class. The isNetworkAnalystLayer property on the layer object can be used to identify whether a given layer object is a network analysis layer. The analysis layer solver type must be route, vehicle routing problem, or closest facility because directions support is required. Also, the network dataset used by the analysis layer must be configured for directions. | Layer |
catalog_path | The catalog path to the output directions feature class. (默认值为 in_memory\Directions) | String |
schema_only | Indicates whether to only generate an empty directions feature class or to also populate it with direction features. (默认值为 False) | Boolean |
configuration_keyword | The configuration keyword of the output directions feature class. (默认值为 None) | String |
返回值
数据类型 | 说明 |
String | 输出方向要素类的目录路径。 |
代码实例
获取路径图层对象并通过它生成方向。
#Get the route layer object from a layer named "Route" in
#the table of contents
RouteLayer = arcpy.mapping.Layer("Route")
#Generate directions features and save them to disk.
arcpy.na.GenerateDirectionsFeatures(RouteLayer,
r'C:\Data\Directions.gdb\RouteDirections')