
Creating geodatabase topology
In a map, topology refers to spatial relationships between features, such as:
- Connectivity: This indicates that rivers from the
WatercourseL
feature class or roads from theRoadL
feature class should be connected - Coincidence: This indicates that the water and roads from the
Watercourse
andRoad
polygon feature classes should be covered by theHydrography
andTransportation
subtypes from theLandUse
feature class - Adjacency: This indicates that parcels from
LandUse
have common edges and should not overlap or have gaps - Containment: This indicates that buildings from the
Buildings
feature class should be within theOther Terrain
(Built-up area
) subtype from theLandUse
feature class
In the ArcGIS context, a topology is a collection of rules that define the spatial relationship between features within a feature class or between features of two or more feature classes belonging to the same feature dataset.
A topology is stored in a file geodatabase as an individual File Geodatabase Topology
element. In a topology, we can apply one or more rules to a feature class. We can apply different rules to the feature subtypes. We can create different and complicated spatial relationships between subtype features of one, two, or more feature classes in a single topology.
In a topology, if we want to define topological rules between features of two or more feature classes belonging to different feature datasets, we have to move them in the same feature dataset. We can have more topology elements in a feature dataset, but a feature class can be implicated in only one topology at a time.
Note
For more details regarding topology and topology rules, please refer the online ArcGIS Help (10.2) by navigating to Geodata | Data types | Topologies at http://resources.arcgis.com/en/help/main/10.2.
Getting ready
The main steps involved in creating a topology are:
- Name the topology.
- Set Cluster Tolerance.
- Add one or more simple feature classes.
- Define the Ranks (importance).
- Add one or more Rules.
- Create the topology in a feature dataset.
- Validate the topology.
Cluster tolerance is the distance range where the feature vertices are considered coincident. Starting from classical cartographic theory, let's consider that absolute accuracy of our dataset at scale 1:5,000
is 0.5
meter. We will use a cluster tolerance of about 0.5/10 = 0.05 meter.
Ranks define what feature vertices will be moved during the validation process.
After we define the topology rules between four feature classes from the Topo5k.gdb
geodatabase, we will validate the topology in order to apply the rules to our feature classes.
How to do it...
Follow these steps to create File Geodatabase Topology
in a file geodatabase using the ArcCatalog context menu:
- Start ArcCatalog. In the Catalog Tree section, go to
<drive>:\PacktPublishing\Data\EditingData
, and selectTopo5k.gdb
. Expand theBuildings
andLandUse
feature datasets. - To create a topology for the
BuildingsR
andLandUse
feature classes, we have to add them in the same feature dataset—LandUse
—as shown in the following screenshot: - Select the
BuildingsR
feature class from theBuildings
feature dataset, and drag-and-drop it in theLandUse
feature dataset. Right-click on theLandUse
feature dataset, navigate to New | Topology, and click on Next. Leave the default value for Enter a name for your topology. For Enter a cluster tolerance, type0.05
, and click on Next. Click on Select All to check all feature classes, and click on Next. Define the relative importance of the feature classes by selecting the following ranks from the Rank drop-down list:BuildingsR
=1
andLandUse
=2
. Click on Next to see the following panel: - Select the Add Rule button. We have three sections: Features of feature class, Rule, and Feature class, as shown in the following screenshot:
- In the first and third sections, we can see the feature classes and their subtypes. This will allow us to define rules at feature subtype levels. In the second section, we have a drop-down list with the topology rules corresponding with the type of geometry. In the Add Rule window, we can define topology rules for a single feature class or between two feature classes. Click on Cancel to return to the New Topology window.
- Select the Load Rules button to add a set of rules:
Rule Set
(*rul
format). Go to...\Data\EditingData
, select theLandUse_Topology.rul
file, and click on Open and on OK to load the rules. - Inspect the rules. We don't have a general rule between all subtypes from
Buildings
andLandUse
. As we can see, the rules refer to theBuildings
andLandUse
subtypes. In this way, we can exclude some feature subtypes from following a rule that applies to all other subtypes from the parent feature class. To exclude a feature subtype, just avoid mentioning it in the list (for example, theBuildingsR:Unknown
subtype). Click on Next and on Finish. Select No in the pop-up window that appears. You will validate the topology in the next step. - In ArcCatalog, select
LandUse_Topology
, and choose the Preview mode to see the topology errors. You will see a blue hatched rectangle. This means that the whole area is not validated and requires topology validation in order to find the errors. This area is called a dirty area. - We can check the topology status in ArcCatalog. Right-click on the
LandUse_Topology
element, and navigate to the Properties | General tab. The topology status isNot Validated
. - Let's validate the topology to identify any errors. Right-click on the
LandUse_Topology
element, select Validate, and from the View menu, select Refresh to see changes in the Preview mode. Now the topology status isValidated-Errors Exist
. - Right-click on the
LandUse_Topology
element, navigate to the Properties | Errors tab, and click on the Generate Summary button to inspect the errors. You can save the report in a.txt
file.Every time we make changes in a topology (add/delete rules or cluster tolerance), the entire area covered by our features will become a dirty area. When we edit the features (for example, change subtypes and add/delete features or vertices), the area surrounding the features will need additional topology validation and will also be considered as a dirty area.
- You can change the value of Cluster Tolerance to see changes in topology status and in the Preview mode.
- If you want to add more rules, open the Properties tab of
LandUse_Topology
, and navigate to the Rules | Add Rule button. Add the rules and validate the topology. Close ArcCatalog.
You can find the final results at ...\Data\EditingData\MyTopologyResults
.
How it works...
A topology has one of the following statuses:
Not Validated
Validated-Errors Exist
Validated-No Errors
- If you edit the features,
Not Validated
with dirty area
A topology is not applied to our data until we validate it. Validation helps us to find errors. Validation generates two processes: cracking and clustering. The connected features are disconnected and connected again by adding/deleting vertices and slightly moving feature vertices based on the cluster tolerance and ranks. In the example from the following screenshot, we exaggerated the value of Cluster Tolerance to 1
meter for the LandUse
topology before the validation process:

Notice in the following screenshot how the vertices were deleted (v1) and moved (v2) after the topology validation:

For more details about the cracking and clustering processes, please refer to the Esri Technical Paper (2010): Understanding Geometric Processing in ArcGIS.
See also
- In the next recipe, Editing geodatabase topology, we will display, analyze, and fix the spatial errors in ArcMap