沿路径定位要素 (线性参考)
摘要
计算输入要素(点、线或面)与路径要素的交集,并将路径和测量信息写入新的事件表。
用法
-
输出表可以是 dBASE 文件或地理数据库表。
-
事件类型在输入要素是点时事件类型必须是 POINT,而在输入要素是线或面时必须是 LINE。
-
在输入要素与目标路径精确重叠时可取得最佳结果。
警告:如果使用较大的搜索半径或拓扑容差克服输入要素与目标路径之间的偏差,则可能产生意想不到的结果。
-
使用创建要素图层工具可有效降低要处理的输入数。
-
使用创建路径事件图层工具或使用 ArcMap 中的“显示路径事件”命令可在 ArcMap 中显示输出表。
语法
参数 | 说明 | 数据类型 |
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 |
代码示例
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")
以下 Python 脚本演示了如何在独立 Python 脚本中使用 LocateFeaturesAlongRoutes 函数。
# Name: LocateFeaturesAlongRoutes_Example1.py # Description: Locate shapefile lines along shapefile routes. # Author: ESRI # 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)
以下 Python 脚本演示了如何在独立 Python 脚本中将 LocateFeaturesAlongRoutes 函数与文件地理数据库数据结合使用。
# Name: LocateFeaturesAlongRoutes_Example2.py # Description: Locate personal geodatabase points along file geodatabase routes. # Author: ESRI # 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)
以下 Python 脚本演示了如何在独立 Python 脚本中将 LocateFeaturesAlongRoutes 函数与个人地理数据库数据结合使用。
# Name: LocateFeaturesAlongRoutes_Example3.py # Description: Locate personal geodatabase points along personal geodatabase routes. # Author: ESRI # 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)
以下 Python 脚本演示了如何在独立 Python 脚本中将 LocateFeaturesAlongRoutes 函数与 SDE 数据结合使用。
# Name: LocateFeaturesAlongRoutes_Example4.py # Description: Locate enterprise geodatabase polygons along enterprise geodatabase routes. # Author: ESRI # 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")