# Example: Bounded Areas

Given line objects, the Trace transform template for geometry fields creates areas in regions entirely enclosed by overlapping or otherwise touching lines.  This topic provides a quick look at how the Transform pane helps create new drawings.

We start with a drawing of Roman roads in France, seen below as a layer in a map.

The drawing and the map are both in Lambert Conformal Conic projection, a meter-based projection.  We would like to create a drawing of area objects where each area neatly fills in a region enclosed by roads.

The roads as seen above are formatted using a style that provides fatter, brown lines.  We have used the Layers pane to specify a beige background color for the map.  As is typical of drawings that represent roads, roads are often drawn using more than one line object, with the ends of the lines exactly coincident.

With the focus on the map window, in the Transform pane we choose the Roads drawing and the Geom field, and then we double-click the Trace template to launch it.

In the Trace template, for the Result destination, we choose New Table and then enter Bounded areas as the name of the New drawing and an analogous name for the New table. We could use whatever names we want, but it is wise to use names that remind us of what they are supposed to be.

If we would like a preview of what the Trace template is about to do, we can press Preview.

Pressing the Preview button shows the previewed results of the Trace operation using blue preview colors along with a blue preview caption bar at the top of the window with the name of the template used for the preview.  The preview shows how regions enclosed by lines will be converted into areas.   Previews can be especially useful with Trace to see places where small breaks in lines may prevent regions from being enclosed.

Previews are shown on top of all map layers.  We can toggle the preview off and on by clicking the blue preview caption bar.   To close the preview, right-click on the caption bar and choose Hide Preview.

To apply the transform, press the Transform button.

A new table and a drawing called Bounded areas appear in the Project pane.

We drag and drop the resulting drawing into the map as a layer below the Roads layer.    We style the resulting drawing so that areas are light green in color and area borders are thin black lines.  We have also used the Layers pane to apply 50% layer opacity to the Roads layer.    The resulting display makes it easy to see the locations of the Roads layer lines and to compare where the Bounding Areas template created area objects.

We can see there are some regions that appear to be enclosed by the fatter, brown Roads lines which did not result in the creation of a bounded area.   That usually happens when there are small breaks in the road lines so that although the region appears to be enclosed by roads, it is not really enclosed.   We can Right-click and drag to zoom in to the end of one such line that appears to enclose a region.

The magenta arrow in the illustration above points out the break.  A line that at higher zoom appears to fully enclose a region in reality does not enclose the region.  It is possible that this is a mistake in this part of the drawing, a failure to draw the end of the line all the way to the obvious juncture nearby.

Of course, it could be that in reality the Romans built this particular road for many kilometers but failed to extend it all the way to the town that was likely located at the junction of the other roads seen nearby.   More likely is that whoever created this drawing simply did not extend the line far enough.

Such drafting errors are frequent in drawings of road networks.   People often create such drawings by either using tools that have poor snapping capability, or without using the snapping capability that is there.  Inexperienced personnel may simply think that because a line seems to have been drawn to connect to the next line that it really does connect, when in reality it fails to touch at high zoom.

Finding such small breaks in a drawing where there should not be any breaks can be challenging.   In the illustration above we see another region that appears to be enclosed but which the Bounded Areas template does not reckon as enclosed.  One technique to find breaks is to Ctrl-click on lines (click the Roads tab first so the focus is on that layer) to select them, and to then look at the ends of those lines at higher zoom to see if any breaks are apparent.

We have Ctrl-clicked on a line to select it, and now we can zoom box into one of the ends of the lines to see if it connects to the next line.

There appears to be a small gap between lines that seem like they should be connected.  We can zoom box even further to take a closer look.

Zoomed far in we see an obvious gap  If we measure the distance using Measurements tools, we can see the gap is about 60 meters.   This is nothing more than a typical error when GIS drawings are created.     Keep in mind that the gap above might not be the only gap that prevents the road lines from enclosing a region.   There could be other gaps as well.

## Notes

Are gaps tedious? -  Yes, really tedious some times.  Finding and repairing errors like gaps is one of the more tedious aspects of GIS work.   The basic problem is that it is very tedious to detect and to repair drawings which contain errors on a scale that is similar to differences in legitimate data.  One way to avoid such problems is to make sure that people who create such data are taught how to use tools, like snapping, that help avoid such mistakes.

Repairing gaps - There are two approaches to filling in a gap such as seen above.  One is to edit one of the existing lines to move the endpoint of that line so it is exactly coincident with the endpoint of the next line.  The other approach is to draw a new, short line to fill the gap, using snapping to ensure it starts exactly at the endpoint of one of the existing lines and then ends exactly at the endpoint of the next line.  Adding a new, gap-filling line has the advantage that it does not alter the original set of lines that were imported.  The new line can have an attribute field that indicates it is a gap-filling line that was added.

In cases where the original set of lines may have some scientific significance or where it is useful to preserve an audit trail of what was done previously, then it might be better to add a new line instead of adjusting existing ones.

## Videos

Manifold 9 - Bounded Areas - The Trace transform template creates areas within regions that are enclosed by lines.   The template works with a single click, and automatically reckons any regions enclosed by either intersecting lines or by lines that are coincident end to end.  Easy!  Works in the free Viewer, too.

Transform Pane

Transform Topics

Transform Reference

SQL Functions