ArcGIS for Desktop Cookbook
上QQ阅读APP看书,第一时间看更新

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 the RoadL feature class should be connected
  • Coincidence: This indicates that the water and roads from the Watercourse and Road polygon feature classes should be covered by the Hydrography and Transportation subtypes from the LandUse 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 the Other Terrain (Built-up area) subtype from the LandUse 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:

  1. Name the topology.
  2. Set Cluster Tolerance.
  3. Add one or more simple feature classes.
  4. Define the Ranks (importance).
  5. Add one or more Rules.
  6. Create the topology in a feature dataset.
  7. 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:

  1. Start ArcCatalog. In the Catalog Tree section, go to <drive>:\PacktPublishing\Data\EditingData, and select Topo5k.gdb. Expand the Buildings and LandUse feature datasets.
  2. To create a topology for the BuildingsR and LandUse feature classes, we have to add them in the same feature dataset—LandUse—as shown in the following screenshot:
    How to do it...
  3. Select the BuildingsR feature class from the Buildings feature dataset, and drag-and-drop it in the LandUse feature dataset. Right-click on the LandUse 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, type 0.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 and LandUse = 2. Click on Next to see the following panel:
    How to do it...
  4. Select the Add Rule button. We have three sections: Features of feature class, Rule, and Feature class, as shown in the following screenshot:
    How to do it...
  5. 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.
  6. Select the Load Rules button to add a set of rules: Rule Set (*rul format). Go to ...\Data\EditingData, select the LandUse_Topology.rul file, and click on Open and on OK to load the rules.
  7. Inspect the rules. We don't have a general rule between all subtypes from Buildings and LandUse. As we can see, the rules refer to the Buildings and LandUse 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, the BuildingsR: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.
  8. 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.
  9. 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 is Not Validated.
  10. 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 is Validated-Errors Exist.
  11. 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.

    Tip

    The Must be larger than cluster tolerance rule is added by default. We cannot remove this rule as it is applied automatically to all features participating in a topology.

    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.

  12. You can change the value of Cluster Tolerance to see changes in topology status and in the Preview mode.
  13. 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:

How it works...

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

How it works...

For more details about the cracking and clustering processes, please refer to the Esri Technical Paper (2010): Understanding Geometric Processing in ArcGIS.

Tip

If you validate a topology in ArcCatalog, you cannot reverse the effects of the validation process.

If you validate a topology in ArcMap, you can undo the changes made through the validation process.

See also

  • In the next recipe, Editing geodatabase topology, we will display, analyze, and fix the spatial errors in ArcMap