摘要
计算输入要素(点、线或面)与路径要素的交集,并将路径和测量信息写入新的事件表。
用法
输出表可以是 dBASE 文件或地理数据库表。
输入要素是点时事件类型必须是 POINT,而在输入要素是线或面时必须是 LINE。
在输入要素与目标路径精确重叠时可取得最佳结果。
要减少此工具处理的输入要素的数量,可以输入能够执行选择操作的图层。有关详细信息,请参阅使用图层和表视图。
使用创建路径事件图层工具或使用 ArcMap 中的“显示路径事件”命令可在 ArcMap 中显示输出表。
语法
LocateFeaturesAlongRoutes_lr (in_features, in_routes, route_id_field, radius_or_tolerance, out_table, out_event_properties, {route_locations}, {distance_field}, {zero_length_events}, {in_fields}, {m_direction_offsetting})
参数 | 说明 | 数据类型 |
in_features | 输入点、线或面要素。 | Feature Layer |
in_routes | 将与输入要素相交的路径。 | Feature Layer |
route_id_field | 包含可唯一识别每条路径的值的字段。该字段可以是数值或字符。 | Field |
radius_or_tolerance | 如果输入要素是点,则搜索半径是数值,定义可在每个点周围的多大范围内执行搜索以找到目标路径。 如果输入要素是线,则搜索容差实际上是拓扑容差,即表示输入线与目标路径之间的最大容许距离的数值。 如果输入要素是面,则忽略此参数且不使用搜索半径。 | Linear unit |
out_table | 要创建的表。 | Table |
out_event_properties | 由要写入输出事件表的路径位置字段和事件类型组成的参数。
| Route Measure Event Properties |
route_locations (可选) | 在沿路径定位点时,对于任何给定的点来说,在搜索半径范围内可能有多条路径。沿路径定位线或面时将忽略此参数。
| Boolean |
distance_field (可选) | 指定是否将名为 DISTANCE 的字段添加到输出事件表。该字段中值的单位与指定搜索半径的单位相同。沿路径定位线或面时将忽略此参数。
| Boolean |
zero_length_events (可选) | 沿路径定位面时,可在“测量始于”等于“测量止于”的位置处创建事件。沿路径定位点或线时将忽略此参数。
| Boolean |
in_fields (可选) | 指定输出事件表中是否包含路径位置字段以及输入要素的所有属性。
| Boolean |
m_direction_offsetting (可选) | 指定计算的偏移距离应基于 M 方向还是数字化方向。如果 distance_field = "DISTANCE",则输出事件表中将包括距离。
| Boolean |
代码示例
LocateFeaturesAlongRoutes 示例 1(Python 窗口)
以下 Python 脚本演示了如何在 Python 窗口中使用 LocateFeaturesAlongRoutes 函数
import arcpy
from arcpy import env
env.workspace = "C:/Data"
arcpy.LocateFeaturesAlongRoutes_lr("rail_segments.shp", "rail_routes.shp", "rkey", "0.5 Feet", "locate_lines", "rkey LINE fmp tmp")
LocateFeaturesAlongRoutes 示例 2(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中使用 LocateFeaturesAlongRoutes 函数。
# Name: LocateFeaturesAlongRoutes_Example1.py
# Description: Locate shapefile lines along shapefile routes.
# Import system modules
import arcpy
from arcpy import env
# Set workspace
env.workspace = "C:/Data"
# Set local variables
feats = "rail_segments.shp"
rts = "rail_routes.shp"
rid = "rkey"
tol = "0.5 Feet"
tbl = "locate_lines"
props = "rkey LINE fmp tmp"
# Execute LocateFeaturesAlongRoutes
arcpy.LocateFeaturesAlongRoutes_lr(feats, rts, rid, tol, tbl, props)
LocateFeaturesAlongRoutes 示例 3(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中将 LocateFeaturesAlongRoutes 函数与文件地理数据库数据结合使用。
# Name: LocateFeaturesAlongRoutes_Example2.py
# Description: Locate personal geodatabase points along file geodatabase routes.
# Import system modules
import arcpy
from arcpy import env
# Set workspace
env.workspace = "C:/Data/Pitt.gdb"
# Set local variables
feats = "rail/crossings" # crossings is in the rail feature dataset
rts = "rail/routes" # routes is in the rail feature dataset
rid = "rkey"
rad = "10 Feet"
tbl = "locate_points"
props = "rkey POINT mp"
# Execute LocateFeaturesAlongRoutes
arcpy.LocateFeaturesAlongRoutes_lr(feats, rts, rid, rad, tbl, props)
LocateFeaturesAlongRoutes 示例 4(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中将 LocateFeaturesAlongRoutes 函数与个人地理数据库数据结合使用。
# Name: LocateFeaturesAlongRoutes_Example3.py
# Description: Locate personal geodatabase points along personal geodatabase routes.
# Import system modules
import arcpy
from arcpy import env
# Set workspace
env.workspace = "C:/Data/Pitt.mdb"
# Set local variables
feats = "rail/crossings" # crossings is in the rail feature dataset
rts = "rail/routes" # routes is in the rail feature dataset
rid = "rkey"
rad = "10 Feet"
tbl = "locate_points"
props = "rkey POINT mp"
# Execute LocateFeaturesAlongRoutes
arcpy.LocateFeaturesAlongRoutes_lr(feats, rts, rid, rad, tbl, props)
LocateFeaturesAlongRoutes 示例 5(独立 Python 脚本)
以下 Python 脚本演示了如何在独立 Python 脚本中将 LocateFeaturesAlongRoutes 函数与 SDE 数据结合使用。
# Name: LocateFeaturesAlongRoutes_Example4.py
# Description: Locate enterprise geodatabase polygons along enterprise geodatabase routes.
# Import system modules
import arcpy
from arcpy import env
# Set workspace
env.workspace = "Database Connections/Connection to Jerry.sde"
# Set local variables
feats = gp.QualifyTableName("counties", wkspc) # standalone feature class
rts = gp.QualifyTableName("rail_routes", wkspc) # standalone feature class
rid = "rkey"
tbl = "locate_polys"
props = "rkey LINE fmp tmp"
# Execute LocateFeaturesAlongRoutes
arcpy.LocateFeaturesAlongRoutes_lr(feats, rts, rid, "#", tbl, props, "#", "#", "NO_ZERO", "M_DIRECTION")
环境
许可信息
- ArcGIS Desktop Basic: 是
- ArcGIS Desktop Standard: 是
- ArcGIS Desktop Advanced: 是