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
|
包含可唯一识别每条路径的值的字段。 此字段可以是数值、文本或 GUID 字段。
|
Field
|
|
in_table
|
将沿路径定位行的表。
|
Table View
|
|
in_event_properties
|
输入事件表中的路径位置字段和事件类型。
Route identifier field—该字段包含指示每个事件所在路径的值。 此字段可以是数值、文本或 GUID 字段。
Event type—输入事件表中的事件类型(POINT 或 LINE)。
From-measure field—包含测量值的字段。 此字段必须是数值字段,在事件类型是 POINT 或 LINE 时必填。
To-measure field—包含测量值的字段。 此字段必须是数值字段,在事件类型是 LINE 时必填。
|
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
(可选)
|
指定将点事件视为点要素还是多点要素。
MULTIPOINT—将点事件视为多点要素。
POINT—将点事件视为点要素。 这是默认设置。
|
Boolean
|
代码示例
MakeRouteEventLayer 示例 1(Python 窗口)
import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.lr.MakeRouteEventLayer("route_hwy.shp", "rkey", "accident.dbf",
"rkey POINT mile", "accident_events", "#",
"ERROR_FIELD", "ANGLE_FIELD")
MakeRouteEventLayer 示例 2(独立脚本)
以下 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"
# Run MakeRouteEventLayer
arcpy.lr.MakeRouteEventLayer(rt, rid, tbl, props, lyr, "#", "ERROR_FIELD",
"ANGLE_FIELD")
MakeRouteEventLayer 示例 3(独立脚本)
以下 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"
# Run MakeRouteEventLayer
arcpy.lr.MakeRouteEventLayer(rt, rid, tbl, props, lyr, "#", "ERROR_FIELD")
MakeRouteEventLayer 示例 4(独立脚本)
以下 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"
# Run MakeRouteEventLayer
arcpy.lr.MakeRouteEventLayer(rt, rid, tbl, props, lyr)