描述
Fills gaps between polygon features that participate in a topology where the coincident boundaries are evident.
Many types of polygon features should have coincident boundaries with other features. Coincident boundaries can be important for features in a single polygon feature class, such as parcels, or between features in different feature classes, such as lakes and surrounding vegetation. A gap between the features exists when there is space between the boundaries of two or more features.
插图
使用方法
This tool requires one or more input feature classes. If only one input feature class is specified, the tool searches for gaps between individual features in that feature class. When multiple feature classes are specified, the tool searches for gaps between all features in all the input feature classes. The tool can find gaps between two features in the same feature class as well as gaps between features in any of the feature classes.
When multiple feature layers are provided and the Fill Options parameter is set to Fill By Length, the area of the gap is added to the feature class that shares the longest boundary with the gap. For instance, if a gap shares a longer boundary with vegetation features and a shorter boundary with lake features, the area of the gap is added to the feature in the vegetation layer.
The order of the inputs in the Input Features parameter list is important when the Fill Options parameter is set to Fill By Order. For instance, if vegetation is first in the list and lakes are the second input polygons when Fill By Order is chosen, the vegetation features are always adjusted to fill the gap.
When searching for gaps between features in multiple feature classes, add all of the feature classes as input polygons. For example, if there should be no gaps between features in the lakes, grass, and forest feature classes, add them to the Input Features parameter. If you add only lakes and forests, the tool can identify a gap between lakes and forests and fill the gap. However, the area that was identified as a gap may have had a grass feature, which results in the modified feature overlapping the grass. To prevent overlaps, add all relevant feature classes to the Input Features parameter.
Unenclosed gaps exist when two polygon boundaries are within a specified distance of each other. The two polygon features do not have to touch each other at any point.
When the Fill Unenclosed Gaps parameter is checked, the unenclosed gaps are filled first. Enclosed gaps are filled after unenclosed gaps are filled.
Enclosed gaps exist when there are gaps between two polygon boundaries.
This tool fills holes in a single feature but does not fill unenclosed gaps between the edges of a single feature. If a feature is a multipart feature, the gaps between the parts are not filled. If a feature curves and different parts of the edge are close to each other creating small gaps, the gaps along the edge are not filled.
警告:
此工具会修改输入数据。有关详细信息以及避免数据被意外更改的策略,请参阅修改或更新输入数据的工具。
语法
arcpy.topographic.FillGaps(input_features, max_gap_area, {fill_option}, {fill_unenclosed_gaps}, {max_gap_distance})
参数 | 说明 | 数据类型 |
input_features [input_features,...] | A list of input polygon feature classes or layers to be analyzed for gaps. | Feature Layer |
max_gap_area | The maximum area that can be considered a gap. Areas larger than this threshold are not filled. | Areal Unit |
fill_option (可选) | Specifies how enclosed and unenclosed gaps are filled.
| String |
fill_unenclosed_gaps (可选) | Specifies whether the tool fills unenclosed gaps.
| Boolean |
max_gap_distance (可选) |
The maximum distance between features in which a gap can be filled. This parameter is used only when the fill_unenclosed_gaps parameter is set to FILL_ALL. | Linear Unit |
派生输出
名称 | 说明 | 数据类型 |
updated_features | The updated feature classes and layers after removing gaps. | Feature Layer |
代码示例
The following stand-alone script demonstrates how to use the FillGaps function to eliminate the spaces between enclosed polygon features.
# Name: FillGaps_sample1.py
# Description: The Fill Gaps tool eliminates the spaces between polygon features. The following stand-alone
# sample script demonstrates how to use Fill Gaps for enclosed features.
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
# Setting the environment
arcpy.env.overwriteOutput = True
# Setting Local Variables
inPoly1 = r'C:\data\SaltLakeCity.gdb\CTM\SettlementSrf'
inPoly2 = r'C:\data\SaltLakeCity.gdb\CTM\HydrographySrf'
inPoly3 = r'C:\data\SaltLakeCity.gdb\CTM\VegetationSrf'
max_gap_area = '700000 SquareMeters'
fill_option = 'FILL_BY_LENGTH'
fill_unenclosed_gaps = 'SKIP_UNENCLOSED_GAPS'
# Create feature layer for input features
arcpy.MakeFeatureLayer_management(inPoly1,'inSettlementSrfLyr')
arcpy.MakeFeatureLayer_management(inPoly2,'inHydrographySrfLyr')
arcpy.MakeFeatureLayer_management(inPoly3,'inVegetationSrfLyr')
# Calling Fill Gaps to eliminate enclosed spaces between SettlementSrf, HydrographySrf, and VegetationSrf features
arcpy.FillGaps_topographic('inSettlementSrfLyr;inHydrographySrfLyr;inVegetationSrfLyr', max_gap_area, fill_option, fill_unenclosed_gaps)
# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))
# Check In Extensions
arcpy.CheckInExtension('Foundation')
The following stand-alone script demonstrates how to use the FillGaps function to eliminate the spaces between unenclosed polygon features.
# Name: FillGaps_sample2.py
# Description: The Fill Gaps tool eliminates the spaces between polygon features. The following stand-alone
# sample script demonstrates how to use Fill Gaps for unenclosed features.
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
# Setting the environment
arcpy.env.overwriteOutput = True
# Setting Local Variables
inPoly1 = r'C:\data\SaltLakeCity.gdb\CTM\SettlementSrf'
inPoly2 = r'C:\data\SaltLakeCity.gdb\CTM\HydrographySrf'
inPoly3 = r'C:\data\SaltLakeCity.gdb\CTM\VegetationSrf'
max_gap_area = '700000 SquareMeters'
fill_option = 'FILL_BY_LENGTH'
fill_unenclosed_gaps = 'FILL_ALL'
max_gap_distance = '20 Meters'
# Create feature layer for input features
arcpy.MakeFeatureLayer_management(inPoly1,'inSettlementSrfLyr')
arcpy.MakeFeatureLayer_management(inPoly2,'inHydrographySrfLyr')
arcpy.MakeFeatureLayer_management(inPoly3,'inVegetationSrfLyr')
# Calling Fill Gaps to eliminate enclosed and unenclosed spaces between SettlementSrf, HydrographySrf, and VegetationSrf features
arcpy.FillGaps_topographic('inSettlementSrfLyr;inHydrographySrfLyr;inVegetationSrfLyr', max_gap_area, fill_option, fill_unenclosed_gaps, max_gap_distance)
# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))
# Check In Extensions
arcpy.CheckInExtension('Foundation')
环境
许可信息
- Basic: 否
- Standard: 否
- Advanced: 需要 Production Mapping