摘要
可按固定间隔或百分比沿线创建点要素。
用法
输入要素的属性将保留在输出要素类中。向输出要素类添加新字段 ORIG_FID,并设置为输入要素 ID。
语法
GeneratePointsAlongLines_management (Input_Features, Output_Feature_Class, Point_Placement, {Distance}, {Percentage}, {Include_End_Points})
参数 | 说明 | 数据类型 |
Input_Features | 要转换为点的线要素。 | Feature Layer |
Output_Feature_Class | 要从输入线创建的点要素类。 | Feature Class |
Point_Placement | String | |
Distance (可选) | 始于线起点处的间隔,点需按该间隔沿线放置。 | Linear Unit |
Percentage (可选) | 始于线起点处的百分比,点需按该百分比沿线放置。例如,如果使用了 40 的百分比,则点将被放置在线距离的 40% 和 80% 处。 | Double |
Include_End_Points (可选) | 指定是否在线的起点和终点放置附加点。
| Boolean |
代码示例
GeneratePointsAlongLines 示例 1(Python 窗口)
以下 Python 窗口脚本演示了如何在即时模式下使用 GeneratePointsAlongLines 函数。
import arcpy
arcpy.env.workspace = 'C:/data/base.gdb'
arcpy.GeneratePointsAlongLines_management('rivers', 'distance_intervals', 'DISTANCE', Distance='500 meters')
arcpy.GeneratePointsAlongLines_management('rivers', 'percentage_intervals', 'PERCENTAGE', Percentage=10)
GeneratePointsAlongLines 示例 2(独立脚本)
以下独立脚本演示了如何使用 GeneratePointsAlongLines。
# Name: GeneratePointsAlongLines_Example2.py
# Description: Convert point features into line features
import arcpy
# Set environment settings
arcpy.env.workspace = 'C:/data/base.gdb'
# Set local variables
in_features = 'rivers'
out_fc_1 = 'distance_intervals'
out_fc_2 = 'percentage_intervals'
# Execute GeneratePointsAlongLines by distance
arcpy.GeneratePointsAlongLines_management(in_features, out_fc_1, 'DISTANCE',
Distance='500 meters')
# Execute GeneratePointsAlongLines by percentage
arcpy.GeneratePointsAlongLines_management(in_features, out_fc_2, 'PERCENTAGE',
Percentage=10,
Include_End_Points='END_POINTS')
环境
许可信息
- ArcGIS Desktop Basic: 是
- ArcGIS Desktop Standard: 是
- ArcGIS Desktop Advanced: 是