Summary
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 may be important for features within 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.
Illustration
Usage
This tool requires one or more input feature classes. If only one input feature class is specified, the tool will look for gaps between individual features in that feature class. When multiple feature classes are specified, the tool will look for gaps between all features in all the input feature classes. The tool will 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 will be 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 selected, the vegetation features will always be adjusted to fill the gap.
When looking for gaps between multiple feature classes, you should 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 in the Input Features parameter. If you only add lakes and forests, the tool may 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 will result in the modified feature overlapping the grass. To prevent possible overlaps, add all feature classes into 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, unenclosed gaps will be filled first. Enclosed gaps will be filled after unenclosed gaps are filled.
Enclosed gaps exist when there are gaps between two polygon boundaries.
This tool does not fill self-gaps. If a feature is a multipart feature or a feature with holes, the tool will not fill the holes or gaps between the parts.
Caution:
This tool modifies the input data. See Tools that do not create output datasets for more information and strategies to avoid undesired data changes.
Syntax
FillGaps(input_features, max_gap_area, {fill_option}, {fill_unenclosed_gaps}, {max_gap_distance})
Parameter | Explanation | Data Type |
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 will not be filled. | Areal Unit |
fill_option (Optional) | Specifies how enclosed and unenclosed gaps are filled.
| String |
fill_unenclosed_gaps (Optional) | Specifies if the tool will fill unenclosed gaps.
| Boolean |
max_gap_distance (Optional) |
The maximum distance between features in which a gap can be filled. Used only when the fill_unenclosed_gaps parameter is set to SKIP_UNENCLOSED_GAPS. | Linear Unit |
Derived Output
Name | Explanation | Data Type |
updated_features | The updated feature classes and layers after removing gaps. | Feature Layer |
Code sample
The following stand-alone script demonstrates how to use FillGaps 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 FillGaps 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')
Environments
Licensing information
- Basic: No
- Standard: No
- Advanced: Requires Production Mapping