Available with Standard or Advanced license.
The primary method for creating a new topology in ArcGIS Pro is the Create Topology wizard. Once you know how to create a topology, you can automate this work using a suite of geoprocessing tools.
Create a topology using the Create Topology wizard
To create a topology using the Create Topology wizard, complete the following steps:
- In the Catalog pane, right-click the feature dataset to which you want to add a topology and click New > Create Topology.
- Name the new topology and specify the cluster tolerance. The default value is set to the x,y tolerance of the feature dataset. A good default value is 0.001 meters or its equivalent in the units of your spatial reference (for example, 0.003281 feet if your units are in feet or 0.0000000556 degrees if your units are in latitude-longitude as decimal degrees).
- Check the boxes of the feature classes that will participate in the topology. You will be shown a list of all the feature classes in your feature dataset.
- Set the coordinate accuracy ranks for each feature class in the topology.
If one or more of your feature classes contain coordinate z-values, click Z Properties to set the z-ranks. The z-tolerance is used to distinguish the z-height, or elevation, of vertices within the tolerance of one another. For example, two adjacent features of different heights might share a common edge between them. However, only their x,y vertices are colocated, not their z-value or height. The z-tolerance helps process this information correctly during validation and clustering operations. The default z-tolerance value is the same default value as the x,y tolerance (0.001 meter in real-world units).
- Click Next.
- Now you will create topology rules between the participating feature classes and their subtypes. From the Feature Class 1 drop-down menu, select a feature class. If you are going to create a rule associated with subtypes, use the Subtype 1 drop-down menu to choose a subtype.
- In the next column, choose the corresponding Rule. Rules help you structure the spatial relationships between features and control and validate how features share geometry.
- If applicable to the rule you have chosen, complete the rule by choosing a second feature class and subtype from the Feature Class 2 and Subtype 2 drop-down menus.
- Repeat steps 6,7,and 8 to create as many rules as necessary. When you are done, click Next.
Review the summary and click Finish. You have now added the new topology to your feature dataset. A message appears asking if you want to validate the topology in your feature dataset. If you have data in your feature classes, click Yes.
Create a topology using geoprocessing tools
ArcToolbox contains a series of geoprocessing tools for topology. The Topology toolset is located in the Data Management toolbox.
These tools can be used to build scripts for creating and modifying geodatabase topologies. Scripts can be used to automate a series of tasks and to build repeatable workflows.
To create a topology using the Create Topology tool, complete the following steps:
- Choose the feature classes that will participate in the topology. Add these feature classes to the topology using the Add Feature Class To Topology geoprocessing tool.
Run this tool multiple times until you've added all of the feature classes that you want to participate in the topology.
- Now that you've created the topology and added some feature classes to it, you can add a series of rules using the Add Rule To Topology geoprocessing tool. Topology rules help you structure the spatial relationships between features and control and validate how features share geometry.
You may also need to run this tool multiple times until you've added all of the desired topology rules to the topology.
- You now have a new topology in your feature dataset with participating feature classes and topology rules. If you have data in your feature classes, use the Validate Topology geoprocessing tool to validate your topology.
The following is a sample stand-alone Python script that you can use to create a topology and add multiple feature classes and rules to the topology:
This stand-alone Python script creates a topology, adds multiple feature classes and rules, and validates the topology.
import arcpy
import os
# Input variables
input_dataset = r"C:\MyProjects\MyProject.gdb\fds"
topo_name = "Topology"
cluster_tol = 0.001
input_fc = r"C:\MyProjects\MyProject.gdb\fds\fc1 1 1;C:\MyProjects\MyProject.gdb\fds\fc2 1 1"
rules = r"'Must Not Overlap (Area)' C:\MyProjects\MyProject.gdb\fds\fc1 # C:\MyProjects\MyProject.gdb\fds\fc1 #;'Must Be Covered By Feature Class Of (Area-Area)' C:\MyProjects\MyProject.gdb\fds\fc1 # C:\MyProjects\MyProject.gdb\fds\fc2 #"
validate = "true"
# Create the topology
out_topo = arcpy.CreateTopology_management(input_dataset, topo_name, cluster_tol)
print("Created topology.")
# Loop through the list of feature classes and add them to the topology
input_fcL = input_fc.split(";")
for fc in input_fcL:
param = fc.rsplit(" ", 2)
in_fc = param[0]
xy_rank = param[1]
z_rank = param[2]
arcpy.AddFeatureClassToTopology_management(out_topo, in_fc, xy_rank, z_rank)
print(arcpy.GetMessages())
# Loop through the list of rules and add rules to the topology
rulesL = rules.split(";")
for rule in rulesL:
r = rule.rsplit(" ", 4)
rule_type = r[0].replace("'","")
in_fc1 = r[1]
subtype1 = r[2]
in_fc2 = r[3]
subtype2 = r[4]
arcpy.AddRuleToTopology_management(out_topo, rule_type, in_fc1, subtype1, in_fc2, subtype2)
print(arcpy.GetMessages())
# Validate the topology
if validate == "true":
try:
arcpy.ValidateTopology_management(out_topo)
except:
print(arcpy.GetMessages())
print("Finished.")