摘要
使用路径和路径事件创建临时要素图层。
如果使用临时图层(在地图上显示临时图层或由其他地理处理工具使用临时图层),则将执行动态分段。
用法
- 输入表可以是 ArcGIS 支持的任何类型的表。 
- 并不是所有类型的表都有 ObjectID 字段。该工具在使用此类表时,生成的图层将无法选择,也无法供某些地理处理操作有效使用。在使用此工具之前,先考虑使用创建查询表工具添加虚拟 ObjectID 字段。 
- 临时图层存储在内存中,在当前的 ArcCatalog 或 ArcMap 会话中可用作其他地理处理函数的输入。 
- 在 ArcMap 中,如果在地理处理 > 地理处理选项... > 将地理处理操作的结果添加到显示中下已指明要将地理处理操作的结果添加到显示中,则可显示临时要素图层。 
- 退出 ArcCatalog 或 ArcMap 后,临时要素图层将从内存中移除。要将临时图层保留在磁盘上,使用保存至图层文件(管理)工具或复制要素(管理)工具。 
语法
MakeRouteEventLayer_lr (in_routes, route_id_field, in_table, in_event_properties, out_layer, {offset_field}, {add_error_field}, {add_angle_field}, {angle_type}, {complement_angle}, {offset_direction}, {point_event_type})| 参数 | 说明 | 数据类型 | 
| in_routes | 用于定位事件的路径要素。 | Feature Layer | 
| route_id_field | 包含可唯一识别每条路径的值的字段。 | Field | 
| in_table | 将沿路径定位行的表。 | Table View | 
| in_event_properties | 输入事件表中由路径位置字段和事件类型组成的参数。 
 | Route Measure Event Properties | 
| out_layer | 要创建的图层。此图层存储在内存中,所以不需要路径。 | Feature Layer | 
| offset_field (可选) | 包含用于使事件从其基础路径偏移的值的字段。该字段必须为数值型。 | Field | 
| add_error_field (可选) | 指定是否将名为 LOC_ERROR 的字段添加到创建的临时图层。 
 | Boolean | 
| add_angle_field (可选) | 指定是否将名为 LOC_ANGLE 的字段添加到创建的临时图层。此参数只有在事件类型为 POINT 时才有效。 
 | Boolean | 
| angle_type (可选) | 指定要计算的定位角的类型。仅当 add_angle_field = "ANGLE_FIELD" 时该参数有效。 
 指定要计算的定位角的类型。此参数仅在选中生成角度字段时才有效。 
 | String | 
| complement_angle (可选) | 指定是否计算定位角的余角。仅当 add_angle_field = "ANGLE_FIELD" 时该参数有效。 
 | Boolean | 
| offset_direction (可选) | 指定将具有正向偏移的路径事件显示在哪一侧。此参数只有在已指定偏移字段时才有效。 
 | Boolean | 
| point_event_type (可选) | 指定将点事件视为点要素还是多点要素。 
 | Boolean | 
代码示例
MakeRouteEventLayer 示例(Python 窗口)
import arcpy
from arcpy import env
env.workspace = "C:/Data"
arcpy.MakeRouteEventLayer_lr ("route_hwy.shp", "rkey" , "accident.dbf", "rkey POINT mile", "accident_events", "#", "ERROR_FIELD", "ANGLE_FIELD")
MakeRouteEventLayer 示例(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中使用 MakeRouteEventLayer 函数。
# Name: MakeRouteEventLayer_Example.py
# Description:  Make a POINT event layer. Routes and events are in a shapefile workspace.
# An error field and an angle field are added to the new layer. The new layer can be used
# by other geoprocessing functions.
# Author: ESRI
# Import system modules
import arcpy
from arcpy import env
# Set workspace
env.workspace = "C:/Data"
# Set local variables
rt = "route_hwy.shp"
rid = "rkey" 
tbl = "accident.dbf"
props = "rkey POINT mile"
lyr = "accident_events" 
# Execute MakeRouteEventLayer
arcpy.MakeRouteEventLayer_lr (rt, rid, tbl, props, lyr, "#",  "ERROR_FIELD",  "ANGLE_FIELD")
MakeRouteEventLayer 示例 2(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中使用 MakeRouteEventLayer 函数。
# Name: MakeRouteEventLayer_Example2.py
# Description:  Make a LINE event layer. Routes and events are in a file geodatabase.
# An error field is added to the new layer. The new layer can be used by other 
# geoprocessing functions.
# Author: ESRI
# Import system modules 
import arcpy
from arcpy import env
# Set workspace
env.workspace = "C:/Data/pitt.gdb"
# Set local variables
rt = "roads/hwy"          # the 'hwy' feature class is in the 'roads' feature dataset
rid = "rkey" 
tbl = "pavecond"
props = "rkey LINE fmp tmp"
lyr = "pave_events" 
# Execute MakeRouteEventLayer
arcpy.MakeRouteEventLayer_lr (rt, rid, tbl, props, lyr, "#",  "ERROR_FIELD")
MakeRouteEventLayer 示例 3(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中将 MakeRouteEventLayer 函数与个人地理数据库数据结合使用。
# Name: MakeRouteEventLayer_Example3.py
# Description: Make a LINE event layer. Routes and events are in a personal geodatabase.
# An error field is added to the new layer. The new layer can be used by other 
# geoprocessing functions.
# Author: ESRI
# Import system modules
import arcpy
from arcpy import env
# Set workspace
env.workspace = "C:/Data/pitt.mdb"
# Set local variables
rt = "roads/hwy"          # the 'hwy' feature class is in the 'roads' feature dataset
rid = "rkey" 
tbl = "pavecond"
props = "rkey LINE fmp tmp"
lyr = "pave_events" 
# Execute MakeRouteEventLayer
arcpy.MakeRouteEventLayer_lr (rt, rid, tbl, props, lyr, "#", "ERROR_FIELD")
MakeRouteEventLayer 示例 4(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中将 MakeRouteEventLayer 函数与 SDE 数据结合使用。
# Name: MakeRouteEventLayer_Example4.py
# Description: Make a POINT event layer. Routes and events are in an enterprise geodatabase.
# The new layer can be used by other geoprocessing functions.
# Import system modules 
import arcpy
from arcpy import env
# Set workspace
env.workspace = "Database Connections/Connection to Jerry.sde" 
# Set local variables
ds = gp.QualifyTableName("roads", wkspc)          # the 'roads' feature dataset
fc = gp.QualifyTableName("hwy", wkspc)            # the 'hwy' feature class 
rt = ds + "/" + fc #the 'hwy' feature class is in the 'roads' feature dataset
rid = "rkey" 
tbl = gp.QualifyTableName("accident", wkspc)
props = "rkey POINT mile"
lyr = "accident_events2" 
# Execute MakeRouteEventLayer
arcpy.MakeRouteEventLayer_lr (rt, rid, tbl, props, lyr)
环境
许可信息
- ArcGIS Desktop Basic: 是
- ArcGIS Desktop Standard: 是
- ArcGIS Desktop Advanced: 是