arcpy.3d.RegularizeAdjacentBuildingFootprint(in_features, group, out_feature_class, method, tolerance, precision, angular_limit)
|
名称
|
说明
|
数据类型
|
|
in_features
|
将要处理的输入要素。
|
Feature Layer
|
|
group
|
此字段用于确定哪些要素将共享重合、非重叠边界。
|
Field
|
|
out_feature_class
|
将生成的要素类。
|
Feature Class
|
|
method
|
要用于规则化输入要素的方法。
RIGHT_ANGLES—Identifies the best line segments that fit the input feature vertices along 90° and 180° angles.
RIGHT_ANGLES_AND_DIAGONALS—Identifies the best line segments that fit the input feature vertices along 90°, 135°, and 180° interior angles.
ANY_ANGLES—Identifies the best fit line that falls along any angle while reducing the overall vertex count of the input features.
|
String
|
|
tolerance
|
规则化覆盖区可从其原始要素的边界偏移的最大距离。
|
Linear Unit
|
|
precision
|
将在规则化过程中使用的空间格网精度。 值的有效范围为 0.05 到 0.25。
|
Double
|
|
angular_limit
|
使用直角和对角 (RIGHT_ANGLES_AND_DIAGONALS) 方法时,要容许的最佳拟合线内部角度的最大偏差。 要获得最佳结果,通常应将该值保持为小于 5°。 对于其他规则化方法,将禁用此参数。
|
Double
|
代码示例
RegularizeAdjacentBuildingFootprint 示例 1(Python 窗口)
下面的示例演示了如何在 Python 窗口中使用此工具:
arcpy.env.workspace = 'c:/data'
arcpy.ddd.RegularizeAdjacentBuildingFootprint('rough_footprints.shp', 'Block_ID',
'regularized_footprints.shp',
'RIGHT_ANGLES_AND_DIAGONALS',
'2 Meters', 0.10)
RegularizeAdjacentBuildingFootprint 示例 2(独立脚本)
下面的示例演示了如何在独立 Python 脚本中使用此工具:
'''****************************************************************************
Name: Classify Lidar & Extract Building Footprints
Description: Extract footprint from lidar points classified as buildings,
regularize its geometry, and calculate the building height.
****************************************************************************'''
import arcpy
lasd = arcpy.GetParameterAsText(0)
dem = arcpy.GetParameterAsText(1)
footprint = arcpy.GetParameterAsText(2)
try:
desc = arcpy.Describe(lasd)
if desc.spatialReference.linearUnitName in ['Foot_US', 'Foot']:
unit = 'Feet'
else:
unit = 'Meters'
ptSpacing = desc.pointSpacing * 2.25
sampling = '{0} {1}'.format(ptSpacing, unit)
# Classify overlap points
arcpy.ddd.ClassifyLASOverlap(lasd, sampling)
# Classify ground points
arcpy.ddd.ClassifyLasGround(lasd)
# Filter for ground points
arcpy.management.MakeLasDatasetLayer(lasd, 'ground', class_code=[2])
# Generate DEM
arcpy.conversion.LasDatasetToRaster('ground', dem, 'ELEVATION',
'BINNING NEAREST NATURAL_NEIGHBOR',
sampling_type='CELLSIZE',
sampling_value=desc.pointSpacing)
# Classify noise points
arcpy.ddd.ClassifyLasNoise(lasd, method='ISOLATION', edit_las='CLASSIFY',
withheld='WITHHELD', ground=dem,
low_z='-2 feet', high_z='300 feet',
max_neighbors=ptSpacing, step_width=ptSpacing,
step_height='10 feet')
# Classify buildings
arcpy.ddd.ClassifyLasBuilding(lasd, '7.5 feet', '80 Square Feet')
#Classify vegetation
arcpy.ddd.ClassifyLasByHeight(lasd, 'GROUND', [8, 20, 55],
compute_stats='COMPUTE_STATS')
# Filter LAS dataset for building points
lasd_layer = 'building points'
arcpy.management.MakeLasDatasetLayer(lasd, lasd_layer, class_code=[6])
# Export raster from lidar using only building points
temp_raster = 'in_memory/bldg_raster'
arcpy.management.LasPointStatsAsRaster(lasd_layer, temp_raster,
'PREDOMINANT_CLASS', 'CELLSIZE', 2.5)
# Convert building raster to polygon
temp_footprint = 'in_memory/footprint'
arcpy.conversion.RasterToPolygon(temp_raster, temp_footprint)
# Regularize building footprints
arcpy.ddd.RegularizeBuildingFootprint(temp_footprint, footprint,
method='RIGHT_ANGLES')
except arcpy.ExecuteError:
print(arcpy.GetMessages())