# Normalizing Topology

The Topology template in the Transform pane for geometry fields, , using the clean (generalize) option, alters drawings in many ways at once by making adjustments in the positions and coordinates that define points, lines and areas, considering all of the objects in a drawing. If objects fall within the distance specified in the template's Tolerance parameter, they will be adjusted to topologically appropriate positions.

The Topology template includes several functions that are executed simultaneously:

• Snap points to nearest lines - Used to prepare drawings for use as networks.

• Resolve overshoots and undershoots - Truncate overshoots and extend undershoots.

• Adjust area boundaries - Clip overlaps and extend areas to fill in gaps.

• When lines intersect or points fall on lines, insert coordinates for lines at the intersection, creating branches.

• Remove redundant coordinates in object metrics that are not shared with other objects.

• Move defining coordinates to the nearest positions consistent with the distance specified in the template's Tolerance parameter, and remove any redundancies.

This latter function leads to the use of Topology for "generalizing" drawings to a lower resolution by running Topology with the desired Tolerance distance, hence the name of the clean (generalize) operation within the Topology template.

Topology : clean (generalize) can handle within the same drawing any mix of points, lines and areas, including branched objects.  Lines and points are pulled to neighboring areas and then lines and points are adjusted between themselves. Topology considers neighboring objects when making adjustments.   For example, it will automatically make fine adjustments so that small gaps do not appear between neighboring areas.

## Example: Remove redundant coordinates

Removing redundant coordinates will remove a dimensionless "spike" of zero width from an area.

Consider an area as shown at left above, which seems to have a dimensionless spike extending from the area.  We Alt-click the area to pick it, to show the vertices (coordinates) that define the area.

Small blue boxes appear at all coordinates which define the area.   As seen above, the dimensionless spike is part of the area and is not an adjacent line.   It appears the boundary of the area goes around the area until it reaches the base of the spike, goes out to the tip of the spike, and then goes back to the base again.

We can see for sure by looking at the coordinates list for the area, to see if there are two coordinates that exactly coincide at the base of the spike.

To put the area into coordinates editing mode, and thus to show the Coordinates tab in the Info pane, we can click any vertex.  We Click the vertex at the base of the dimensionless spike.   A large editing handle appears at that vertex to indicate it is the active vertex, and the boxes marking other coordinates grow larger to show the object is in coordinates editing mode.

The Info pane automatically switches to the Coordinates tab, with the cursor on the row for the active vertex.   Looking at the list it is clear there are coincident coordinates, but we can save ourselves the trouble of searching lists with a quick visual move to highlight coincident vertices.

We Ctrl-drag a selection box to select all vertices within.  If there is more than one vertex at the base of the spike, they all will be selected.   Selected vertices are shown in dark blue color within an object that is being edited, and their corresponding rows in the Coordinates tab are shown with red selection background color.

The red background color makes it easy to see coordinates which are coincident, that is, they have exactly the same X and Y coordinates.    The Coordinates list shows how the area boundary goes through two vertices to the first selected vertex, shown in red,  at the base of the spike and then it continues out to the tip of the spike, and then returns back to a vertex located at exactly the same coordinate location, also selected and shown in red.  That creates a dimensionless spike.

To remove the dimensionless spike, we use the Topology template.

With the focus on the open window, in the Transform pane we choose the Drawing (as the only layer in the window it will already be chosen) and we choose the Geom field in the drawing.    Double-click the Topology template to launch it in the Transform pane.

In the Transform pane the clean (generalize) operation is picked.   We choose a Tolerance setting of 0, the default, for automatic tolerance.

The Result is automatically set to New Table, the only allowed result choice.   We specify Topologized drawing for the name of the New drawing to be created by the template, with an analogous name for the New table.    We can use whatever names we want, but it makes sense to specify a name that will remind us of what the new drawing is supposed to be.  An ungrammatical, but mnemonic, name like "Topologized drawing" is not a bad choice.

Press Transform.

A new drawing called Topologized drawing and its table appear in the Project pane.   We drag and drop the new Topologized drawing into the open window as a layer:

Dropping the resulting drawing into our drawing as a layer (and turning off the layer for the original Drawing) we see the spike has been eliminated.  We Alt-click the area, click the vertex to enter coordinates editing mode, and then again Ctrl-drag to select the vertex where the base of the spike used to be, along with selecting any other vertex in that spot.

Only one of the two coordinates that was previously selected remains.  The distant coordinate that was the tip of the dimensionless spike has been removed, as was the duplicate coordinate to which the area boundary returned.

## Example: Move points to nearest lines

Points might fall near to a line but not actually lie on that line or not be coincident with a coordinate location that defines the line.

Consider the illustration above, where a point may appear to be coincident with the end of a line.

Zooming far in, we see that the point is not actually on the line.  It is not coincident with the end of the line.

With the focus on the open window, in the Transform pane we choose the Point and Line drawing (as the only layer in the window it will already be chosen) and we choose the Geom field in the drawing.    Double-click the Topology template to launch it in the Transform pane.

In the Transform pane the clean (generalize) operation is picked.   We choose a Tolerance setting of 1, which the Unit setting we have chosen (the default) says is one Meter.    The distance between point and line is well under a meter (we can measure the distance using path measurement), so using a tolerance of one meter should move the two together.

The Result is automatically set to New Table, the only allowed result choice.   We specify Topologized point and line for the name of the New drawing to be created by the template, with an analogous name for the New table.

Press Transform.

A new drawing called Topologized point and line and its table appear in the Project pane.   We drag and drop the new Topologized point and line drawing into the open window as a layer:

We format the layer to use a green dot for the point.  We can see that the end of the line has been moved to the point.

## Example:  Multiple operations at once

The Topology template automatically performs all operations it does at the same time.

Consider a drawing as shown above.  It consists of four lines, an area, and eight points.  Some of the lines intersect each other.  The orange line overshoots the area boundary.   None of the points fall on any line.

With the focus on the open window, in the Transform pane we choose the objects drawing (as the only layer in the window it will already be chosen) and we choose the Geom field in the drawing.    Double-click the Topology template to launch it in the Transform pane.

In the Transform pane the clean (generalize) operation is picked.   We choose a Tolerance setting of 10, and we choose a Unit setting of Meter.   Using a tolerance of ten meters will adjust point, line and area positions in this drawing.

The Result is automatically set to New Table, the only allowed result choice.   We specify Topologized objects for the name of the New drawing to be created by the template, with an analogous name for the New table.

Press Transform.

A new drawing called Topologized objects and its table appear in the Project pane.   We drag and drop the new Topologized objects drawing into the open window as a layer:

The layer appears using default formatting.  We can use Style to color objects in the layer the same as the original objects drawing.

We can now compare the new, "topologized" drawing with the original drawing.  The orange line which overshot into the green area has been trimmed to the edge of the area.   All points falling within the Tolerance distance of a line (all points in this example) have been moved to be placed exactly on lines.   Lines have been adjusted to acquire new coordinates, creating branches, where they intersect other lines or where points have been moved onto the lines.    The new coordinates have been added in locations that are consistent with the Tolerance used.

The effect of creating new coordinates where lines intersect or where points have been placed creates new branches in the lines, and it also often will convert what once was a straight line into a series of branches that together no longer form a straight line.

Consider the original drawing seen at left above.  The straight blue line has been picked with an Alt-click, so the coordinates of the line show up as handles in the drawing and then one of the coordinates was clicked to make the coordinate boxes larger.  The line is defined by two coordinates.  It is a single branch that is a single, straight segment between those two coordinates.    At right above we see the result of Topology : clean (generalize), with the same blue line picked with a Alt-click and then a coordinate clicked.

The resulting line is defined by many coordinates.  It consists of six straight line segments, each of which is a separate branch.   Lined up as they are, end to end, the six segments do not form a straight line, because the coordinates which define them have been moved slightly to fall within the Tolerance rounding that was used.

## Comparison to Reshape : smooth

The Reshape : smooth template is similar to the Topology template. However, the smooth operation simplifies on a per-object basis while the Topology template considers relationships between objects when simplifying them. We can see the difference by running both templates on a drawing of Mexico.

We begin with a drawing of Mexico that has been projected into Pseudo-Mercator projection.

With the focus on the open window, we choose the Geom field and we double-click on the Reshape template to launch it in the Transform pane.

As an Operation option we choose the smooth operation.  We enter 25000 for the Tolerance parameter, leaving the Unit choice at the default of Meter.

The Result is automatically set to New Table, the only allowed result choice.   We specify Smoothed Mexico for the name of the New drawing to be created by the template, with an analogous name for the New table.

Press Transform.

A new drawing called Smoothed Mexico appears in the Project pane.   We drag and drop the new Smoothed Mexico drawing into the map as a layer:

We have styled the Smoothed Mexico layer using the same style as the original Mexico layer.   Each area has been simplified without considering any relationships with adjacent areas. This provides an optimal simplification when each area is considered by itself but that also results in overlaps and gaps between areas.

We can now try Topology.   With the focus on the open window, we choose Mexico as the target layer and we again choose the Geom field.  We double-click on the Topology template to launch it in the Transform pane.

In the Transform pane the clean (generalize) operation is picked.   We enter a Tolerance setting of 25000, leaving the Unit setting at the default Meter setting.

The Result is automatically set to New Table, the only allowed result choice.   We specify Topologized Mexico for the name of the New drawing to be created by the template, with an analogous name for the New table.

Press Transform.

A new drawing and its table called Topologized Mexico appears in the Project pane.   We drag and drop the new Topologized Mexico drawing into the map as a layer:

Topology : clean (generalize) can take longer to run than smooth, but the result is free of overlaps and gaps.  Each area has been adjusted both by fitting coordinates to the specified Tolerance but also by considering the fitting of neighboring areas.  However, it could be said that the resulting shape for each individual object, without regard to neighboring areas, is not as "optimal" a simplification as is done by smooth.

When simplifying a single object it is probably best to use smooth since the result is obtained much faster. When simplifying many objects for which adjacency must be maintained it is best to use Topology.

## Differences between Topology and Clean : normalize metric

The Clean template has a normalize metric operation that is similar to the function of Topology : clean (generalize).  Both of these transform operations are used to produce a clean metric; however, the metric produced by normalize metric may be slightly different than that produced by Topology. The main difference between them is that normalize metric is run on a per-object basis while Topology is run on an object set as a whole.  When processing metrics Topology considers neighboring objects and normalize metric does not:

• Topology will detect overlapping areas and will assign the region of overlap to one of the overlapping areas while clipping it from the others. In this same circumstance normalize metric will leave the overlaps.

• Topology will snap points to the nearest object (such as the end of a line) if the distance between the point and the object is less than the Tolerance. normalize metric will leave points unmoved.

• Topology will detect an intersection between two lines and will split the lines at the intersection. normalize metric will leave the lines unchanged.

Both Topology and normalize metric will remove redundant coordinates, but Topology may leave some redundant coordinates that would be removed by normalize metric. Topology will leave any redundant coordinates that are also coordinates in any other object. This is done to guarantee that a common border between any two adjacent objects is exactly the same in both objects. normalize metric will not retain redundant coordinates since it operates only on single objects.

How should we choose between Topology and normalize metric? In most cases, we would like any adjustments to object metrics to proceed with the entire object set in mind so in most cases we would use Topology in preference to normalize metric.

One of the cases where we might prefer normalize metric over Topology is when we must deal with a seriously inaccurate drawing that is known to contain many redundancies in object metrics, which we would like to quickly fix so that all subsequent operations are faster. In this case we could first run normalize metric at, say, one-fourth of the eventual Tolerance precision, and then run Topology at the desired Tolerance precision.

When dealing with imported drawings that may contain specific features of the metric that are to be preserved, users may choose to begin operations by running Topology. This will clean object metrics while preserving redundant coordinates that are coincident with coordinates in other objects.

Tech Tip  - To prevent Topology from moving coordinates about (snapping points and the ends of lines to each other, etc.), we simply set the Tolerance precision to a very small value. That small value should be some value considerably less than any possible distance between distinct coordinates that occur in objects.  For example, in a drawing originating from a USGS DLG where the normal accuracy is ten meters,  using a Tolerance of 0.001 meter will assure that no coordinates are moved by Topology.

Transform Pane

Transform Topics

Transform Reference

Transform - Geometry: Clean

Transform - Geometry: Topology

Info Pane

SQL Functions