Add Rule To Topology (Data Management)

Summary

Adds a new rule to a topology.

The rules you choose to add depend on the spatial relationships that you wish to monitor for the feature classes that participate in the topology.

For a complete list and description of the available topology rules, see geodatabase topology rules and topology error fixes for points, lines, or polygons.

Usage

  • You can enter the name of the subtype value to which you want a topology rule to be applied.

Syntax

arcpy.management.AddRuleToTopology(in_topology, rule_type, in_featureclass, {subtype}, {in_featureclass2}, {subtype2})
ParameterExplanationData Type
in_topology

The topology to which the new rule will be added.

Topology Layer
rule_type

The topology rule to be added. For a complete list of the rules and what they do, see the topology rules and fixes for point, line, or polygon features.

  • Must Not Have Gaps (Area) This rule requires that there are no voids within a single polygon or between adjacent polygons. All polygons must form a continuous surface. An error will always exist on the perimeter of the surface. You can either ignore this error or mark it as an exception. Use this rule on data that must completely cover an area. For example, soil polygons cannot include gaps or form voids-they must cover an entire area.
  • Must Not Overlap (Area) Requires that the interior of polygons not overlap. The polygons can share edges or vertices. This rule is used when an area cannot belong to two or more polygons. It is useful for modeling administrative boundaries, such as ZIP Codes or voting districts, and mutually exclusive area classifications, such as land cover or landform type.
  • Must Be Covered By Feature Class Of (Area-Area) Requires that a polygon in one feature class (or subtype) must share all of its area with polygons in another feature class (or subtype). An area in the first feature class that is not covered by polygons from the other feature class is an error. This rule is used when an area of one type, such as a state, should be completely covered by areas of another type, such as counties.
  • Must Cover Each Other (Area-Area) Requires that the polygons of one feature class (or subtype) must share all of their area with the polygons of another feature class (or subtype). Polygons may share edges or vertices. Any area defined in either feature class that is not shared with the other is an error. This rule is used when two systems of classification are used for the same geographic area, and any given point defined in one system must also be defined in the other. One such case occurs with nested hierarchical datasets, such as census blocks and block groups or small watersheds and large drainage basins. The rule can also be applied to nonhierarchically related polygon feature classes, such as soil type and slope class.
  • Must Be Covered By (Area-Area) Requires that polygons of one feature class (or subtype) must be contained within polygons of another feature class (or subtype). Polygons may share edges or vertices. Any area defined in the contained feature class must be covered by an area in the covering feature class. This rule is used when area features of a given type must be located within features of another type. This rule is useful when modeling areas that are subsets of a larger surrounding area, such as management units within forests or blocks within block groups.
  • Must Not Overlap With (Area-Area) Requires that the interior of polygons in one feature class (or subtype) must not overlap with the interior of polygons in another feature class (or subtype). Polygons of the two feature classes can share edges or vertices or be completely disjointed. This rule is used when an area cannot belong to two separate feature classes. It is useful for combining two mutually exclusive systems of area classification, such as zoning and water body type, where areas defined within the zoning class cannot also be defined in the water body class and vice versa.
  • Must Be Covered By Boundary Of (Line-Area) Requires that lines be covered by the boundaries of area features. This is useful for modeling lines, such as lot lines, that must coincide with the edge of polygon features, such as lots.
  • Must Be Covered By Boundary Of (Point-Area) Requires that points fall on the boundaries of area features. This is useful when the point features help support the boundary system, such as boundary markers, which must be found on the edges of certain areas.
  • Must Be Properly Inside (Point-Area) Requires that points fall within area features. This is useful when the point features are related to polygons, such as wells and well pads or address points and parcels.
  • Must Not Overlap (Line) Requires that lines not overlap with lines in the same feature class (or subtype). This rule is used where line segments should not be duplicated, for example, in a stream feature class. Lines can cross or intersect but cannot share segments.
  • Must Not Intersect (Line) Requires that line features from the same feature class (or subtype) not cross or overlap each other. Lines can share endpoints. This rule is used for contour lines that should never cross each other or in cases where the intersection of lines should only occur at endpoints, such as street segments and intersections.
  • Must Not Have Dangles (Line) Requires that a line feature must touch lines from the same feature class (or subtype) at both endpoints. An endpoint that is not connected to another line is called a dangle. This rule is used when line features must form closed loops, such as when they are defining the boundaries of polygon features. It may also be used in cases where lines typically connect to other lines, as with streets. In this case, exceptions can be used where the rule is occasionally violated, as with cul-de-sac or dead-end street segments.
  • Must Not Have Pseudo-Nodes (Line) Requires that a line connect to at least two other lines at each endpoint. Lines that connect to one other line (or to themselves) are said to have pseudo nodes. This rule is used where line features must form closed loops, such as when they define the boundaries of polygons or when line features logically must connect to two other line features at each end, as with segments in a stream network, with exceptions being marked for the originating ends of first-order streams.
  • Must Be Covered By Feature Class Of (Line-Line) Requires that lines from one feature class (or subtype) must be covered by the lines in another feature class (or subtype). This is useful for modeling logically different but spatially coincident lines, such as routes and streets. A bus route feature class must not depart from the streets defined in the street feature class.
  • Must Not Overlap With (Line-Line) Requires that a line from one feature class (or subtype) not overlap with line features in another feature class (or subtype). This rule is used when line features cannot share the same space. For example, roads must not overlap with railroads or depression subtypes of contour lines cannot overlap with other contour lines.
  • Must Be Covered By (Point-Line) Requires that points in one feature class be covered by lines in another feature class. It does not constrain the covering portion of the line to be an endpoint. This rule is useful for points that fall along a set of lines, such as highway signs along highways.
  • Must Be Covered By Endpoint Of (Point-Line) Requires that points in one feature class must be covered by the endpoints of lines in another feature class. This rule is similar to the line rule Endpoint Must Be Covered By except that, in cases where the rule is violated, it is the point feature that is marked as an error rather than the line. Boundary corner markers might be constrained to be covered by the endpoints of boundary lines.
  • Boundary Must Be Covered By (Area-Line) Requires that boundaries of polygon features must be covered by lines in another feature class. This rule is used when area features need to have line features that mark the boundaries of the areas. This is usually when the areas have one set of attributes and their boundaries have other attributes. For example, parcels might be stored in the geodatabase along with their boundaries. Each parcel might be defined by one or more line features that store information about their length or the date surveyed, and every parcel should exactly match its boundaries.
  • Boundary Must Be Covered By Boundary Of (Area-Area) Requires that boundaries of polygon features in one feature class (or subtype) be covered by boundaries of polygon features in another feature class (or subtype). This is useful when polygon features in one feature class, such as subdivisions, are composed of multiple polygons in another class, such as parcels, and the shared boundaries must be aligned.
  • Must Not Self-Overlap (Line) Requires that line features not overlap themselves. They can cross or touch themselves but must not have coincident segments. This rule is useful for features, such as streets, where segments might touch in a loop but where the same street should not follow the same course twice.
  • Must Not Self-Intersect (Line) Requires that line features not cross or overlap themselves. This rule is useful for lines, such as contour lines, that cannot cross themselves.
  • Must Not Intersect Or Touch Interior (Line) Requires that a line in one feature class (or subtype) must only touch other lines of the same feature class (or subtype) at endpoints. Any line segment in which features overlap or any intersection not at an endpoint is an error. This rule is useful where lines must only be connected at endpoints, such as in the case of lot lines, which must split (only connect to the endpoints of) back lot lines and cannot overlap each other.
  • Endpoint Must Be Covered By (Line-Point) Requires that the endpoints of line features must be covered by point features in another feature class. This is useful for modeling cases where a fitting must connect two pipes or a street intersection must be found at the junction of two streets.
  • Contains Point (Area-Point) Requires that a polygon in one feature class contain at least one point from another feature class. Points must be within the polygon, not on the boundary. This is useful when every polygon should have at least one associated point, such as when parcels must have an address point.
  • Must Be Single Part (Line) Requires that lines have only one part. This rule is useful where line features, such as highways, may not have multiple parts.
  • Must Coincide With (Point-Point) Requires that points in one feature class (or subtype) be coincident with points in another feature class (or subtype). This is useful for cases where points must be covered by other points, such as transformers must coincide with power poles in electric distribution networks and observation points must coincide with stations.
  • Must Be Disjoint (Point) Requires that points be separated spatially from other points in the same feature class (or subtype). Any points that overlap are errors. This is useful for ensuring that points are not coincident or duplicated within the same feature class, such as in layers of cities, parcel lot ID points, wells, or streetlamp poles.
  • Must Not Intersect With (Line-Line) Requires that line features from one feature class (or subtype) not cross or overlap lines from another feature class (or subtype). Lines can share endpoints. This rule is used when there are lines from two layers that should never cross each other or in cases where the intersection of lines should only occur at endpoints, such as streets and railroads.
  • Must Not Intersect or Touch Interior With (Line-Line) Requires that a line in one feature class (or subtype) must only touch other lines of another feature class (or subtype) at endpoints. Any line segment in which features overlap or any intersection not at an endpoint is an error. This rule is useful where lines from two layers must only be connected at endpoints.
  • Must Be Inside (Line-Area) Requires that a line is contained within the boundary of an area feature. This is useful for cases where lines may partially or totally coincide with area boundaries but cannot extend beyond polygons, such as state highways that must be inside state borders and rivers that must be within watersheds.
  • Contains One Point (Area-Point) Requires that each polygon contains one point feature and that each point feature falls within a single polygon. This is used when there must be a one-to-one correspondence between features of a polygon feature class and features of a point feature class, such as administrative boundaries and their capital cities. Each point must be properly inside exactly one polygon and each polygon must properly contain exactly one point. Points must be within the polygon, not on the boundary.
String
in_featureclass

The input or origin feature class.

Feature Layer
subtype
(Optional)

The subtype for the input or origin feature class. Enter the subtype's description (not the code). If subtypes do not exist on the origin feature class, or you want the rule to be applied to all subtypes in the feature class, leave this blank.

String
in_featureclass2
(Optional)

The destination feature class for the topology rule.

Feature Layer
subtype2
(Optional)

The subtype for the destination feature class. Enter the subtype's description (not the code). If subtypes do not exist on the origin feature class, or you want the rule to be applied to all subtypes in the feature class, leave this blank.

String

Derived Output

NameExplanationData Type
out_topology

The updated topology.

Topology Layer

Code sample

AddFeatureClassToTopology example (stand-alone script)

The following stand-alone script demonstrates how to use the AddRuleToTopology function.

# Name: AddRuleToTopology_Example.py
# Description: Adds a rule to a topology

# Import system modules
import arcpy

# Any intersection of ParcelOutline (BlockLines subtype only) needs to be reviewed
arcpy.AddRuleToTopology_management("C:/data/Landbase.gdb/LegalFabric/topology", 
                                   "Must Not Intersect (Line)",
                                   "C:/data/Landbase.gdb/LegalFabric/ParcelOutline",
                                   "BlockLines")

Environments

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics