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

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

GetTravelModes

  • 描述
  • 使用方法
  • 语法
  • 代码示例
  • 环境
  • 许可信息

描述

获取一份针对组织配置的出行模式列表,该列表可与 ArcGIS Online network analysis services 结合使用。出行模式代表了一种交通方式,如驾车行驶或步行。出行模式本质上是由一长串出行设置构成的模板。

使用方法

  • 运行后,工具会向应用程序添加一张表格 Supported Travel Modes。地理服务中,Supported Travel Modes 表格内所有 Travel Mode Name 字段的值都可以指定为各种工具(例如 FindRoutes)所支持的 travel_mode 参数的输入。您还可以将 Travel Mode Settings 字段中的值指定为 travel_mode 参数的输入。由于 FindRoutes 等工具不必根据出行模式名称查找设置,因而加快了所用工具的执行速度。
  • 工具不支持任何输入参数

语法

arcpy.naagol.GetTravelModes()

派生输出

名称说明数据类型
supportedTravelModes

支持的出行模式列表。

列表
defaultTravelMode

服务的默认出行模式。

字符串

代码示例

GetTravelModes 示例

以下 Python 脚本演示了如何在脚本中使用 GetTravelModes 工具。

'''
The script shows how to use the GetTravelModes tool to get a list of travel modes supported by your
ArcGIS Online organization.
'''
import sys

import arcpy

#Change the username and password applicable to your own ArcGIS Online account
username = "<your user name>"
password = "<your password>"
 
utility_service = "https://logistics.arcgis.com/arcgis/services;World/Utilities;{0};{1}".format(username, password)

#Add the geoprocessing service as a toolbox.
arcpy.ImportToolbox(utility_service)

#Call the tool
result = arcpy.Utilities.GetTravelModes()

#Print any warning or error messages returned from the tool
result_severity = arcpy.GetMaxSeverity()
if result_severity == 2:
    arcpy.AddMessage("An error occured when running the tool")
    arcpy.AddMessage(arcpy.GetMessages(2))
    sys.exit(2)
elif result_severity == 1:
    arcpy.AddMessage("Warnings were returned when running the tool")
    arcpy.AddMessage(arcpy.GetMessages(1))

#Retrieve the travel mode table
output_tm_table = result.getOutput(0)

#Save the travel mode table in memory.
output_tm_table.save("in_memory/TravelModes")

#Use a cursor to build a list of travel mode names from the table
arcpy.AddMessage("Travel Modes configured for your organization")
travel_mode_names = []
with arcpy.da.SearchCursor(output_tm_table, ["Name"]) as cursor:
    for row in cursor:
        travel_mode_names.append(row[0])
        arcpy.AddMessage(row[0])

环境

此工具不使用任何地理处理环境。

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

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

关于 Esri

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