描述
使用路径和路径事件创建临时要素图层。
如果使用临时图层(在地图上显示临时图层或由其他地理处理工具使用临时图层),则将执行动态分段。
使用方法
语法
arcpy.lr.MakeRouteEventLayer(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 |
代码示例
import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.MakeRouteEventLayer_lr("route_hwy.shp", "rkey", "accident.dbf",
"rkey POINT mile", "accident_events", "#",
"ERROR_FIELD", "ANGLE_FIELD")
以下 Python 脚本演示了如何在独立 Python 脚本中使用 MakeRouteEventLayer 函数。
# Name: MakeRouteEventLayer_Example2.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.
# Import system modules
import arcpy
# Set workspace
arcpy.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")
以下 Python 脚本演示了如何在独立 Python 脚本中使用 MakeRouteEventLayer 函数。
# Name: MakeRouteEventLayer_Example3.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.
# Import system modules
import arcpy
# Set workspace
arcpy.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")
以下 Python 脚本演示了如何在独立 Python 脚本中将 MakeRouteEventLayer 函数与企业级地理数据库数据结合使用。
# 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
# Set workspace
arcpy.env.workspace = "C:/MyProject/myConn.sde"
# Set local variables
ds = arcpy.ValidateTableName("roads", wkspc) # the 'roads' feature dataset
fc = arcpy.ValidateTableName("hwy", wkspc) # the 'hwy' feature class
rt = ds + "/" + fc # the 'hwy' feature class is in the 'roads' feature dataset
rid = "rkey"
tbl = "accident"
props = "rkey POINT mile"
lyr = "accident_events2"
# Execute MakeRouteEventLayer
arcpy.MakeRouteEventLayer_lr(rt, rid, tbl, props, lyr)
许可信息
- Basic: 是
- Standard: 是
- Advanced: 是