A geodatabase topology is another construct that is stored within a geodatabase and gives us added control over assessing and maintaining the integrity of our spatial data.
Follow this link to download the data for this part of the lesson: Topology.zip
The zip archive contains the following:
An Esri Personal Geodatabase: geodatabasetopol.mdb
A zip archive: TopologyProject.zip
Controlling spatial data integrity by imposing rules - Geodatabase Topology
A geodatabase topology provides a robust way of defining topological relationships among spatial features. It does so by analyzing coordinate locations of feature vertices both among features within a feature class and between features in multiple feature classes taking part in the topology. Therefore it is not only important that all of the feature classes participating in a geodatabase topology be in the same coordinate system, but also that the measurement precision defined for each feature class be the same. To assure that this is the case, all feature classes that take part in a geodatabase topology must reside within what is known as a Feature Dataset. When a feature dataset is created the coordinate system and precision are defined and any subsequent feature class that is added to the feature dataset inherits that coordinate system and precision. In the exercise that follows you will see that the precision is controlled by the Tolerance and Resolution settings. I encourage you to read more about these topics in the Desktop Help when you have time. Search on "topology rules" and then select the "Topology in ArcGIS" topic entry.
A geodatabase topology is governed by topology "rules" that the user specifies and those rules are based on knowledge of the relationships between and among the features that will be taking part in the topology. So the onus is on the user to understand the data being created/edited in order that appropriate rules are specified. Rules can be added to and taken away from a topology as long as the data is not part of an active ArcMap editing session.
The manifestation of a geodatabase topology is as a layer in the feature dataset. As such the topology errors that it contains are symbolized just as are the features in any other map layer in ArcMap. In the Desktop Help search on "topology rules" and then select the "Geodatabase topology rules and topology error fixes" topic entry. This will take you to a compilation of the types of rules that can be defined along with suggestions for ways to fix violations of each rule and a description of how the errors are symbolized in the map data frame, as Points, Lines and Areas. If you are inclined to adorn your walls with GIS help guides you will find a link to a topology rules poster in the opening passage to the Help page I just referred you to. Whether you print it out or not it offers a bit more in the way of graphic description and examples of the rules.
Once topology rules have been imposed on the data in a feature dataset errors are discovered by "validating" the topology. Validation can be done on the entire visible extent of the data or on a smaller specified area. The latter technique allows you to just check an area that you have been editing rather than the entire dataset. This can save time when the entire dataset is large.
As is mentioned above one needs to be aware of how the features involved in a geodatabase topology relate to each other in order to be able to define appropriate topology rules to govern the creation of spatial data and aid in discovering errors in existing data. In the following exercise we will be working with the data depicted in the image below and I will be the arbitrary source of what is known about the relationships among the features in the four feature classes involved. We will be basing our choices of rules on the following:
- the polygons in the FDpolygon_1 feature class must have a single point feature within them
- all of the polygons in the FDpolygon_1 feature class must be within the polygons (there is only one) in the FDpolygon_2 feature class
- the polygons in the FDpolygon_1 feature class must have no gaps between them
- the polygons in the FDpolygon_1 feature class must not overlap
- all of the lines in the FDline feature class must be within the FDpolygon_2 polygons
- all of the lines in the FDline feature class cannot be joined to only one other line feature in the feature class (In topology parlance, the point where only two line segments meet is called a pseudo-node, or -vertex.)
- where lines in the FDline feature class meet they must be snapped together (The end of a line feature that is not connected to another line feature is said to dangle.)
A. Create and interact with a Geodatabase Topology
- Open ArcCatalog.
- Navigate to your geodatabasetopol.mdb geodatabase.
- Within the geodatabasetopol.mdb geodatabase is a feature dataset named TopolExFeatureDataset and within it are four feature classes. Verify this and Preview the data in the feature classes if you wish. You might also check the XY Coordinate System and the Tolerance and the Resolution of the some of the feature classes to see that those settings are indeed the same for each feature class.
- Right-click on the TopolExFeatureDataset name | expand New| select Topology. This will start the New Topology wizard.
- Accept the defaults for the name and for the cluster tolerance. Click Next.
- In the next window click the Select All button to include all of the feature class layers in the geodatabase topology that we are creating.
- Click Next. We now have the option to assign a rank value to each feature class. The lower the number the higher the rank. A high rank value indicates that positions of the features in that feature class are known more accurately or that we do not want them to move relative to layers of lower rank during an editing operation. Let's arbitrarily assign the following ranks (though nothing we do in the steps that follow will illustrate the effect of the rankings):
- 1 - FDpolygon_1
- 2 - FDpolygon_2
- 3 - FDline
- 4 - FDpoint
- Click Next. Now based on our knowledge and understanding of how the spatial data in the feature classes are topologically related, we need to specify the rules that help us to ensure that those spatial relationships are maintained. To comply with the relationships among the features that we outlined above use the Add Rule... button to choose the following rules:
- FDpoint | Must Be Properly Inside | FDpolygon_1
- FDpolygon_1 | Must Be Covered By Feature Class Of | FDpolygon_2
- FDpolygon_1 | Must Not Have Gaps
- FDpolygon_1 | Must Not Overlap
- FDline | Must Be Inside | FDpolygon_2
- FDline | Must Not Have Pseudo Nodes
- FDline | Must Not Have Dangles
- Click Next. You can review the choices just made.
It will process for a moment and then ask if you would "...like to validate it now?"
- Click No. We will validate the topological relationships later in ArcMap.
Now within your TopolExFeatureDataset feature dataset there will be a geodatabase topology "layer" named TopolExFeatureDataset_Topology.
- Open ArcMap and initiate a new map document.
- You will need the Topology toolbar and the Editor toolbar so add them to the display if they are not already there.
- Expand the Catalog pane. (If you do not see the tab on the upper-right side, go to the Windows menu and select Catalog.)
Navigate into the TopolExFeatureDataset.
- Drag-and-drop the TopolExFeatureDataset_Topology into your data frame.
Click Yes when it asks if you want to add the feature classes that participate in the topology.
The topology layer should display at the top of the Table of Contents list. This is important in order to be able to view the topology errors when they are symbolized. See Figure 5.16, below.
- Alter the symbology and rearrange the order of the 4 feature class layers in order to clearly see the features they contain.
Do not label the features yet.
- Start an editing session. This will awaken the Topology toolbar.
You can hide the Create Features pane (click the push pin icon).
- Take note of the components on the Topology toolbar.
- The icon on the far-right end of the Topology toolbar invokes the Error Inspector. Click it.
The Error Inspector will display beneath the data frame by default. Resize your ArcMap window as needed in order to see it.
- Recall that when we created the geodatabase topology in ArcCatalog we chose not to validate the topological relationships at that time. Let's do that now. First be certain you can view all of the features in the map display area. You literally need to be able to see the features -- it isn't enough that they are in the data frame, if they are in the data frame but covered by the Error Inspector pane for example, they will not be validated.
The Validate Topology in Current Extent tool is the third icon from the right end of the Topology toolbar.
Several features in the colors indicated in the Table of Contents pane for the topology layer should be visible. We will spend the next several steps investigating what they tell us.
(The image below also shows the results of the feature labeling we will do in the next step.)
- Before we proceed let's label the features in the data frame with the values in the OBJECTID field of each feature class. For each layer bring up the Layer Properties window | select the Labels tab | change the Label Field to OBJECTID | click OK. Then right-click on the layer name in the table of contents and select Label Features.
- Keep in mind what you read above, at the beginning of this section, in regard to what are the desired spatial relationships of the features in the dataset we are working with.
Expand the Show: picklist in the Error Inspector, and choose FDline - Must Not Have Pseudo Nodes, and then click the Search Now button. NOTE: It is still important that all of the features still be visible in the data frame.
Two entries will appear in the Error Inspector table.
- Click on the row in the Error Inspector that holds the first error entry, where Feature 1 is 10 and Feature 2 is 16. The Feature # is the value of the OBJECTID field. This is why I had you label the features with the values in the OBJECTID field.
This type of error is represented by a Point Error symbol, the pink square. When you click the row in the Error Inspector the pink square that separates line features 10 and 16 will turn black thus indicating the location of the instance that violates this particular topological rule, each line feature in the FDline feature class should share an end point with at least two other lines. The highlighted Point Error indicates a situation where only two line features are sharing an endpoint.
- If you right-click on the line entry in the Error Inspector it will bring up a list (see Figure 5.17 below) from which you can choose to, among several things, Merge or Merge To Largest. These are two choices in the context of this particular type of error for fixing the problem. The Merge choice gives you an option to choose one of the two line features. The implication is that the attributes associated with the chosen line will be those retained for the new single line feature that is a result of the Merge.
Go ahead and experiment with the choices in the list. You can always Undo any change you make. (Ctrl-Z, or Edit menu | Undo... or use the Undo... tool icon.)
- There is a second violation of the Must Not Have Pseudo Nodes error. Highlight it via the Error Inspector. You'll see that it is where line features 8, 14 and 15 are supposed to meet. If you zoom in far enough on that intersection you will see that line 8 is not snapped at the intersection of lines 14 and 15.
- It turns out that one of our other rules would have also highlighted an error in that same area. Do you know which one? Expand the Show: picklist in the Error Inspector, and choose FDline - Must Not Have Dangles, and then click the Search Now button.
- In the list of errors click the first row where Feature 1 is equal to 8 (it ought to be third from the bottom). That should also highlight a vertex in the vicinity of where line feature 8 is supposed to be snapped at the intersection of lines 14 and 15. Which vertex is highlighted? It is the end vertex of the 8 line feature.
The list of Must Not Have Dangles errors contains 10 entries. It is important to realize that not all dangling line feature endpoints are actually errors. It is acceptable to have dead end streets for example.
- It is also important to realize that the Must Not Have Dangles rule only pertains to features in a single layer. If you click through the list of ten dangle errors you will see that three of the entries on the list are where line features 7, 8 and 9 meet the corners of polygon 11 (the FDpolygon_2 feature). If you do some investigating you will find that the end of line 7 is indeed snapped to the corner vertex of polygon 11. Even so the geodatabase topology still flags it as a possible error. To prove to yourself that line 7 is snapped to the polygon boundary you may need to invoke a Map Topology. Do you recall how from having taken Geography 484?
- Now let's look at the FDpolygon_1 - Must Not Have Gaps error results.
Select it from the Show: picklist in the Error Inspector.
Then hit the Search Now button. You should see two results listed in the Error Inspector represented by the Line Error symbol.
- One of the Error Inspecctor entries, when chosen from the list, will show the result depicted in the image below (Figure 5.18).
Click on the two entries until you find it.
Part of the description of this topology rule includes the following: "An error will always exist on the perimeter of the surface. You can either ignore this error or mark it as an exception."
- Let's mark this as an exception.
Right-click on the error entry in the Error Inspector table and choose Mark As Exception. The pink lines marking the perimeter of each of the polygons will disappear and the error will disappear from the Errors list.
Note the Exceptions check box. You can search for things that you have marked as such if need be.
- Highlight the remaining error on the list, take note of where it is (between polygons 2 and 5) and in the table of contents window, un-check the box controlling the display of the topology layer. This will prevent the topology features from hiding what we are looking for. When you zoom in far enough you should discover a gap between FDpolygon_1 polygons 2 and 5. Someone did not do a good job of making sure the FDpolygon_1 features shared boundaries.
Let's stick with the FDpolygon_1 polygon layer and perform an edit. While we are at it we will learn how to highlight areas in our data that have been modified/edited. These "dirty areas," as they are referred to, let us know that we should validate the topology again.
- Zoom back out to Full Extent.
In the Error Inspector show the FDpolygon_1 - Must Not Overlap error, and hit the Search Now button. There should be two errors. We are going to focus on the error involving polygons 2 and 3.
- Turn off the display of the topology layer and zoom in on the location of the overlap error between polygons 2 and 3 until you have a good view of the overlap. You could elect to change the display of the layer to "Hollow" in order to see the overlap more definitely.
- Now before we attempt to correct the error, go to the Layer Properties of the TopolExFeatureDataset_Topology layer | select the Symbology tab | check the box for Dirty Areas | click OK. A new "Dirty Areas" hatch symbol will appear in the table of contents under the topology layer.
- Let's rectify the overlap using the canned error correction choice provided by the Error Inspector. Right-click on the error in the Error Inspector and select Merge from the menu.
- In the Merge window that opens click on each of the two entries. Doing so will cause the polygon that the overlap area will be merged with to be flicker-highlighted.
- Choose the first of the two -- the PLY12(FDpolygon_1) entry and then click the OK button.
- If you still have the display of the TopolExFeatureDataset_Topology layer un-checked check the box now. Polygon 3 should be highlighted in the hatch pattern, indicating that it is a dirty area -- that a change has been made since the topology rules were last validated.
- Zoom to full extent. We are going to use the Validate Topology In Specified Area tool (fourth from the end on the Topology toolbar) to see if the correction we made to the overlap is no longer considered an error. Select that tool and click-drag a rectangle that will encompass the hatched area. When you let off the mouse button the hatched area should disappear indicating that the error has been correctly dealt with as far as our topology rules are concerned.
To prove this to yourself you can hit the Search Now button and see how many overlap errors are found. There should be only one left.
- You should save your edits now.
- Deliverable- I want to see that you were able to perform the correction we just went though so zip up your geodatabasetopol.mdb geodatabase and upload it to the Project 5 Drop Box.
You should be getting a feel for how to interact with the Error Inspector.
Go ahead and spend some time investigating the other rules infractions to see if you can determine the reasons for the other error symbols that you see on the map.
- Why is there a Point Error at the bottom-left corner of the FDpolygon_1 polygon 5 feature (point 3)?
- Why is line 9 highlighted?
If you want, attempt to correct some of the other errors. Not all of them (like the gap we found between the two polygons) have canned fixes via the Error Inspector. So if you are pining away for a chance to do some editing be my guest.
I leave it up to you to choose whether or not to save the map document, and any edits you make.
B. Using topology editing tools with shared polygon boundaries
With a geodatabase topology in place there are certain tools at your disposal that enable you to maintain topological relationships when you make edits to spatial data. Here we contrast editing a shared polygon boundary with and without having a geodatabase topology set up. It is important to realize that the "shared" boundary between two polygons actually is a duplicate set of line segments, each polygon boundary exists as complete and independent from the adjacent polygon. So when a shared boundary needs to be edited one must actually edit the boundaries of two polygons.
- First we will look at the case where we have no topology imposed on the data and we attempt to edit a shared polygon boundary with the Edit Vertices tool . The images below illustrate what happens. Because only one feature can be selected when editing with the Edit Vertices tool, only one instance of the extent of the shared boundary can be edited at a time. The images depict a simple case, but think of a situation where three or four polygons share a common corner vertex.
- With a geodatabase topology in place one can first use the Topology Edit Tool to select the length of the shared boundary. Then using the Modify Edge tool (which when invoked causes the vertices to display) a shared vertex can be selected and moved, editing both polygon boundaries at the same time. Holding down the Shift key when selecting vertices allows you to select more than one.
C. Project - Given a single feature class in a geodatabase, set up a geodatabase topology and deal with a single class of error
Because this is not a course in inputting and editing spatial and attribute data we are choosing to focus on what needs to be done to prepare to implement a geodatabase topology. There will be some errors in spatial data to repair but it involves going over ground already covered in section A of the lesson.
Unzip the TopologyProject.zip archive. The archive contains a folder named TopologyProject. Within that folder is a map document (TopologyProject.mxd file), a geodatabase (TopologyProject.gdb) and a georeferenced image of a map (with ancillary files). When you unzip the archive keep the folder and its contents intact. The map document is set to maintain relative paths to the data that it points to so after you have extracted the folder and you navigate into it and double-click on the TopologyProject.mxd, the map image and the single feature class contained in the geodatabase should be present in the resulting ArcMap session.
The BuildingFootprints feature class contains some instances of polygon overlap that need to be repaired.
In order for you to accomplish finding and repairing the errors in the BuildingFootprints feature class you are going to have to create and employ a geodatabase topology. You know from section A how to create a geodatabase topology and you know that in order to do so the data in question has to reside within a feature dataset. What we did not explicitly go over in the lesson was how to (1) create a feature dataset, and (2) how to get existing data, in this case the feature class contained in the TopologyProject.gdb, into a feature dataset that we create. But that's what I want you to do. Given that Geography 484 or comparable experience was the prerequisite for taking this course you should be able to do it.
Once you have accomplished that proceed to find and correct the overlapping building footprint polygons. All of the offending features will be in the area covered by the included georeferenced map image. You can use it as reference to make sure you are performing the corrections to the polygons correctly.
When you finish zip up your version of the TopologyProject.gdb and upload it to the Lesson 5 Drop Box.