ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

StreetDirectionsProperties

  • 描述
  • 讨论
  • 属性
  • 代码示例

描述

为街道方向属性提供读写访问,使您可自定义网络分析图层的方向输出。可通过 SolverProperties 对象读取和设置 StreetDirectionsProperties,该对象可通过 GetSolverProperties 函数获取。

讨论

StreetDirectionsProperties 对象可为街道方向属性提供读写访问,使您可自定义网络分析图层的方向输出。

可以读取和设置的属性包括 language、lengthUnits、styleName、timeAttribute、outputSpatialReference。

StreetDirectionsProperties 对象仅可用于“路径”、“最近设施点”和“车辆配送”网络分析图层。其他网络分析图层类型不支持输出方向。此外,在不支持方向的网络数据集上构建的网络分析图层也不支持使用 StreetDirectionsProperties 对象。如果该图层不受支持,将返回一个 Python None 对象。

修改 StreetDirectionsProperties 对象的属性后,相应的图层可立即与其他函数和地理处理工具配合使用。无需刷新或更新图层,通过上述对象进行的修改便可生效。

属性

属性说明数据类型
language
(可读写)

指定写入输出文本方向时所采用的语言。具体的可用语言取决于您机器上安装的语言,可使用 ListDirectionsLanguages 函数进行查看。

String
lengthUnits
(可读写)

指定输出文本方向中用于测量长度的距离单位。这些单位必须是以下字符串值中的一个:

  • Fee
  • Kilometers
  • Meters
  • Miles
  • NauticalMiles
  • Yards
String
styleName
(可读写)

指定输出文本方向的样式。对于打印、在导航设备上使用或查找步行路径等不同的应用,提供的样式也不同。具体的可用样式取决于您机器上安装的样式,可使用 ListDirectionsStyleNames 函数进行查看。

String
timeAttribute
(可读写)

指定基于时间的网络数据集成本属性,从而支持计算输出方向上的行驶时间。可用的 timeAttribute 值是网络数据集的一个属性。您可使用网络数据集 describe 对象来在网络数据集中列出各个成本属性。

String
outputSpatialReference
(可读写)

指示输出方向要素类的空间参考。此属性的输入必须是一个空间参考对象。

SpatialReference

代码示例

StreetDirectionsProperties 示例(工作流)

读取路径图层,将其长度单位设置为千米并生成方向要素。

import arcpy

try:

    arcpy.CheckOutExtension("network")

    #Get the route layer object from a layer named "Route" in
    #the table of contents.
    RouteLayer = arcpy.mapping.Layer(r'C:\Data\Route.lyr')

    # Get the solver properties of the layer.
    SolverProps = arcpy.na.GetSolverProperties(RouteLayer)

    # Get the street directions properties
    DirectionsProps = SolverProps.streetDirectionsProperties

    # Set the lengthUnits to Kilometers
    DirectionsProps.lengthUnits = "Kilometers"

    # Set the outputSpatialReference to web mercator
    sr = arcpy.SpatialReference(3785)
    DirectionsProps.outputSpatialReference = sr

    # Get the time attribute used for directions for use later
    timeAttribute = DirectionsProps.timeAttribute

    #Generate directions features and save them to disk.
    arcpy.na.GenerateDirectionsFeatures(RouteLayer,
                                        r'C:\Data\Directions.gdb\RouteDirections')

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "An error occured on line %i" % tb.tb_lineno
    print str(e)

相关主题

  • 路径分析
  • 最近设施点分析
  • 车辆配送 (VRP) 分析

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2021 Esri. | 隐私政策 | 法律声明