Example: Edit Covered Objects

Working with drawings where within the same drawing some areas completely cover smaller areas is a bad idea, but sometimes we have to work with data in that form whether we like it or not.   This topic shows techniques that can help us select and edit objects that are completely hidden by higher objects.  


Tech tip: When objects completely cover other objects that is a situation best handled by using multiple drawings, so that objects which cover other objects can be placed into higher or lower layers as desired.   Layers are the user interface element that allows us to deal with "higher / lower" relationships in a simple, point-and-click way.   If we must keep data in a form where higher and lower objects are stored within the same drawing, that necessarily complicates things.   


The techniques below are mostly a collection of practical hacks as an experienced user might apply them.   Some, such as Alt-clicking on a group of overlapping object and expecting  the lowest object to be picked (the object which is drawn first because it was encountered first) might not apply in all cases.  For example, when many threads are generating many different objects to feed to the rendering engine there is no guarantee what will be considered upper or lower.   The techniques described in this topic are still worthwhile hacks to try in most cases, before resorting to more intricate workflow.

When Larger Areas Cover Smaller Areas

When several different objects are located at exactly the same locations with exactly the same shapes it is a good idea to keep them in separate drawings, so they can appear in a map in separate layers.  For example, if we create three points at exactly the same location within the same drawing when that drawing is opened it will appear that only a single point exists at that location: when all three points are stacked on top of each other at exactly the same location, if they are styled the same way there is no visual indication there are three points at that location.


Within the same drawing Manifold will draw areas first, lines second and points third.  That rule ensures that points will not be hidden by areas above them.   Areas are drawn in whatever order the database engine fetches them.  Since tables are unordered, areas may be drawn in various orders.   Since rendering can be optimized through the use of multiple threads or by other means, there is no guarantee that even if records within a table are displayed in some particular order that objects in a drawing corresponding to each record also will be rendered in the same order.


Likewise, when larger areas are located and sized so they completely cover smaller areas in the same drawing, there is no visual indication that a smaller area might be underneath the larger area.

Consider the illustration above, showing a drawing as if it were seen in an inclined view, representing a drawing where two smaller triangular areas have been drawing below two larger rectangular areas. The illustration represents a single drawing, where all four area objects are in that same drawing.  It does not show two drawings as layers where one drawing is a layer above the other drawing.



In real life, of course, drawings are not something we can tilt and look into.   In real life, we would see that drawing as shown above, in a map window or a drawing window.   If areas use a solid area style we could not see through the upper areas and we would never know there are two triangular areas underneath.    


Given the popular use of solid area styles to format areas in drawings, because we cannot see smaller areas that happen to lie under bigger areas within the same drawing, it is a very bad idea to arrange our data in drawings so that smaller areas are hidden by bigger areas.    When smaller areas are hidden by bigger areas,  a tremendous advantage of GIS, the visual cues a drawing gives us by displaying data visually, turns into a big disadvantage because we cannot trust the visual cues we see.   If something is hidden, then we no longer have the benefit of "what you see is what you get."


Therefore, we should do all possible to clean up our data and to organize it as best as possible to avoid situations where larger areas are drawn to overlap smaller areas.    When that is not possible and we find ourselves having to work with such unclean data, the tips in this topic can help.

Transparent Area Fill Color

The simplest way to show smaller areas that fall below larger areas is to use transparent color for area fill color in the Style pane.




We alter settings in the Style pane so the area color used for borders is a thematic format using the above palette based on mfd_id, and we set the area Fill color to transparent.



Right away, the hidden areas appear.   That is great, but if we use the above style settings is that we cannot tell what is an object drawn with lines and what is an area.  That is easy to fix.



We can differentiate between objects that are areas and objects that are lines by using a hatch pattern style for areas.   We choose the vertical lines hatch pattern in the Symbol button, and then we press the Rotation button to apply a thematic format that varies the angle of the hatch lines.



The hatch pattern is drawn using foreground color, with transparent color used for the area fill.  That allows the lower areas to be seen through the upper areas.  It is clear from the "filling" of the inside of the area with a hatch pattern that an object is an area, and not a figure drawn with line objects.

Select and Delete

After using transparent color for area fill and hatch patterns for styles we can see formerly hidden areas.  We can then utilize various mouse moves to select and to otherwise work with whichever area we want.    We begin with selection.



Ctrl-click on the blue hatched area, clicking on a spot safely outside the red hatched area underneath.



The upper area is selected.  



We can press Delete to delete it.  That leaves the lower area.   If the upper area was important to us, we could have Copied it and Pasted it to another drawing, so it could be in its own layer, before deleting it.

Adjust the Selection and Delete

Suppose we would like to select the lower area?



Ctrl-click within the bounds of the orange hatched area.



Both the orange hatched area and the larger, pale green hatched area are selected, since the click was within both.   We now Shift-Ctrl-click onto the selected larger area to deselect it, choosing a location to click that we know is safely outside the smaller area.  



The result is that the larger area is deselected while the smaller, lower area remains selected.



We can now press Delete to delete the smaller, lower area.

Alt-click to Pick Objects

When multiple objects are stacked on top of each other in the same drawing, what object an Alt-click picks will depend on happenstance, but whatever object is picked in the stack will be clearly shown as picked, using blue preview color.  


If we are working in a map that has multiple layers, and there are objects in different layers that overlap each other, we can Shift-Alt-click to pick the uppermost object in the stack of layers, regardless of which layer is active.  See the discussion in the Layers pane topic on Pick Mode.



In the illustration above, we have Alt-clicked onto the red hatched triangle, which has been rendered below the blue hatched rectangle.



That picks the red hatched triangle, displaying field values in the Info pane.  



To edit the shape of that red hatched triangle we could click the Coordinates tab of the Info pane, or we could have clicked any of the vertices or segments in the picked, red triangle.



To clear our choice of a picked object we can Alt-click in a blank spot to clear our choice of the triangle.



If we would like to pick a different object, we can simply Alt-click or Shift-Alt-click on it on a spot where other objects do not overlap.  For example, we Alt-click on the larger, blue hatched rectangle.



That picks the larger, blue hatched rectangle, instead of the smaller, red hatched triangle.

Alt-Click and Overlaps for Next / Previous Ordering

As with any high-end database, records in tables in Manifold cannot be assumed to have any order, especially when we link in a drawing and table from an enterprise-class database, like MySQL, Oracle, or PostgreSQL.    Therefore, when we pick an object with an Alt-click we cannot assume that the Next and Previous buttons in the Info pane will jump to nearby objects and not far across a drawing full of thousands or millions of objects.


A useful exception to that "no order" rule is that when we Alt-click in a location at which more than one object overlaps, the Alt-click will pick one of those overlapping objects, but it will also build a virtual order for up to nine more of the overlapping objects for the purpose of Next and Previous ordering.    That allows us to quickly use Next and Previous to step through the objects that overlap at the Alt-clicked spot.   If we keep pressing Next past the collection of overlapping objects, then the usual jump will happen to whatever object is next beyond that initial collection of overlapping objects, continuing onward if we keep pressing Next to step through all other objects.



We Alt-click a location within both the red triangle and the blue rectangle.



One of the two overlapping objects is picked, the red triangle.  



The Info pane automatically opens as well.  


 We can click the Next button to see the next record.    The usual situation in a database is that the next record could be any object at all, and not an object near the red triangle that is the current pick.  However, in the case of an Alt-click at a location where objects overlap, Manifold arranges a virtual order for all objects overlapping at the spot that was Alt-clicked that groups those ahead of all other objects when Next is pressed.   Whatever comes next will be one of those overlapping objects.



The next record is the blue rectangle.    This may not be so impressive in a drawing with only four objects, where only two objects overlap in the Alt-clicked position, but the effect becomes much more valuable in a drawing with millions of objects where several objects may overlap in the same spot.   It then becomes very useful that all of the objects overlapping at that spot form a virtual grouping, all together at the very beginning of the Next / Previous sequence.


If we pressed Previous we could go back to the red triangle.



 In the Info pane, if we press Next we go past the virtual order for the two objects that overlapped at the Alt-clicked position, and we continue to whatever is next in the random order of the table.



In this case, that happens to be the orange triangle.


For useful tips on using Next and Previous, including how to limit Next and Previous to only those objects that overlap, see the illustrated examples in the Info Pane: Component topic.

Alt-click Through an Object

We can pick a first-drawn, and thus lower, object even if we cannot see it.



Suppose we use solid area style so we cannot see objects below the larger, upper objects.   We can Alt-click into the middle of the blue rectangle where we know the click falls within the bounds of the unseen red triangle underneath.



Even though it is not seen, the red triangle underneath may be picked. If it is not picked immediately, using Next will pick it, as shown above.  A blue preview of the outline together with edit handles at the vertices of the area appear.    This is clearly a hack, but sometimes it is a very quick and convenient hack.    


We can press the Next or Previous button in the Info pane to jump to whatever overlapping object we want in a stack.

Manage Objects using a Field

We can create a new field in a table and use it to select higher or lower objects.   Such fields are often called "Z" fields because they specify higher or lower order of rendering.   Since heights in GIS are often called Z values (as in the third dimension, Z, after X and Y dimensions) the lower to higher order in which objects are rendered is called Z ordering.



Suppose we add a field called Size and for the areas in our sample drawing we assign the value of Small, for the smaller triangles, or Big, for the bigger rectangles.  We have also edited the Name of the objects to simplify names from using colors, as in "red triangle" to simply "triangle."



We can provide more systematic visual cues on what is higher or lower by doing thematic formatting based on the Size field.



In the above, all Small objects have been formatted pale green and all Big objects have been formatted orange.



We can use a quick hack to "hide" the Big objects by double-clicking into their color well in the thematic format and changing their color to transparent color.



The result is that the upper, Big objects, those that normally hide the lower, Small objects, seem to disappear.   That gives us a clear view of the lower objects.   But this is a hack, a risky hack at that, to use thematic formatting to hide some objects.



We double-click onto the color well in the thematic format for the Big objects and choose orange color, and then we press Update Style.



That makes the Big objects re-appear.

Using the Select Pane

We can exploit the contents of records to select areas based on fields.   To select the smaller areas below the larger ones, we can use the Select pane to select records with Small in the Size field.


In what follows we have restored the prior thematic formatting, using red, blue, orange and green colors.  



Recall the attributes for the objects in the drawing, as seen in the drawing's table:



With the focus on either the table window or the map window, in the Select pane we choose the Size field and then we double-click the Search template to launch it.



In the Search template we choose equal (=) as the Condition option.   For the Value we enter Small.   We leave other parameters at their defaults.


For the Action, we use the default replace selection option.


Press Preview to see a preview.



Right away, the Select pane will preview what will be selected.  A blue preview caption bar appears at the top of the window with the name of the template being previewed.   


Press Select.  



That selects the two triangles in the drawing.  We can then Shift-Ctrl-click either of the areas we wish to de-select, if we do not want to select them both.



The corresponding records in the table are also selected.    We can de-select records in the table if we prefer.   With only two records to select in a small table we could easily have selected them in the table, instead of using the Select pane.  But if we had thousands of records it would be much more convenient to use the Select pane.  Even with a few dozen records, using the Select pane is less error-prone than manually ctrl-clicking into a table.

Copy Lower Objects into a New Layer

It is so easy to copy and paste objects that we can use copy and paste to make copies of areas that might be hidden by other areas.



To copy areas, in the table we then press Ctrl-C to Copy the selected records.   If the drawing's table is not open, we can right-click the Drawing tab and choose Open Table to open the table for that drawing.   


Next, in the Project pane we press Ctrl-V to Paste or we click the Paste toolbar button.  That creates a new table.  We right-click the table and choose Create - New Drawing, and we name the new drawing Small, a name we choose to remind us what the drawing contains.



We drag and drop the Small drawing as a layer into our map, styling the new layer to use yellow area fill color.   It now shows exact copies of the two triangles that were rendered below the larger rectangles.   In the illustration above, we have used solid area style, to show how the upper, Small, layer can be used as a guide to show objects that are hidden below solid-colored areas.


This is a quick and dirty way of exploiting layers to get access to objects that are hidden in below other objects, or which are otherwise difficult to pick.   If we want to see field values for either of those triangles, we can just Alt-click the one we are interested in.  Because it is an exact copy, with attribute values the same it gives us the same read-out in the Info pane as would the original object that is hidden from view in the Drawing layer.

Use the New Layer as a Guide Layer

Even if we now use a solid style in the Drawing layer, we can still see from the Small layer where the lower triangles are located, by using what we can easily see in the Small layer as a guide.



In the illustration above we have used the Layers pane to make the Small drawing only 40% opaque, that is, partially transparent.   We have clicked the Drawing tab to move the focus onto the Drawing layer.    Now, when we Alt-click that click will apply only to objects in the Drawing layer.   We are only using the objects in the Small layer above it as a guide.



The picked symbology for lines and vertices is for the lower, unseen triangle that is in the Drawing layer and below the larger, blue rectangle.   If the wrong object (the rectangle) was picked when we Alt-clicked, we could have pressed the Next button to pick the other object that overlapped at the Alt-clicked position, the triangle.



We click one of the vertices to switch the vertex boxes into edit handles, and then we drag the clicked, larger vertex  to a new location.  In the Info pane we click Update Record to apply the change.  We could also press Ctrl-Enter in the map to commit the change.



The result may be visually unexpected:  when we edited the lower, previously-unseen triangle we made the record a "newer" record in the table.  It now is drawn after the larger, blue rectangle so it now appears above the larger, blue rectangle.   


We Alt-click outside any of the objects to un-pick the red triangle, for a simpler display.



What we see in the display above is the red shape of the edited object.  Part of it appears orange because we are seeing that part of the red shape through the partially-transparent yellow triangle in the Small layer above.   The combination of partially-transparent yellow plus red results in an orange color in that region.



Double-clicking the Small layer off, we can see how the Drawing layer now looks.   What used to be a smaller, red triangle that was rendered below the larger, blue rectangle has been reshaped by our editing and is now drawn above the larger, blue rectangle.

Misconception: Order By in a Query does not Control Rendering

It is easy to forget that the order in which records appear is not the order in which we can safely assume they will be rendered.    This especially can lead to error if we crate a Z field we intend to give the rendering order, and order the table by that Z field.  Such fields are often called "Z" fields because they specify higher or lower order of rendering.   Since heights in GIS are often called Z values (as in the third dimension, Z, after X and Y dimensions) the lower to higher order in which objects are rendered is called Z ordering.



In the table above, we have added a Z field with numbers from 1 to 4 for each object.



We can write a query called z order that generates the same table, but ordered as a results table based on Z value.   The query text we use is:


SELECT * FROM [Drawing Table]



Running the query creates a results table with records in Z order:



We can then create a drawing from that query using the procedure described in the Example: Create a Drawing from a Query topic.  We drag and drop the resulting drawing into our map, and we style it the same as Drawing, as seen in illustrations above.



At first glance, the drawing seems to do what we might expect.  It renders objects in their Z order as given in the results table of the query.  Because the orange triangle comes last in the table (with a Z of 4) it is rendered last, above the larger, pale green rectangle.    The red triangle comes first in the results table (with a Z of 1) so it is rendered first, that is, below the larger, blue rectangle.


But this is a case where results using small data and a simple situation are deceiving.   There is no guarantee in what order objects will be rendered regardless of the order in which they appear in a table when there are larger numbers of objects or more threads.   Suppose we have a complex query that runs using many threads, but it generates relatively few records in the results table.   Despite having few objects exactly in what order the different threads contribute to that results table is not predictable, and the order in which records are taken from that table to be drawn is also not predictable.    


Therefore, we can use a field like the example Z field to guide our work with selection if we want to select and then copy and paste, but we cannot force a display, at least not yet, to be rendered in order based upon a field.  It is likely as Manifold evolves that in the future options will be added to use Z order for rendering.  Stay tuned!


Tech Tip: This topic uses a simple query to generate objects, so we can create a drawing from that query.  It works perfectly, but at the cost of the system asking us if we would like to build a temporary spatial index whenever we open the drawing that was created from the query.   We can avoid that by using a slightly more sophisticated query that automatically generates a spatial index on the geom field.  The more sophisticated approach is illustrated in the Example: Create a Drawing Dynamically from a Geocoded Table  topic.


The more sophisticated query:  


TABLE CALL TableCacheIndexGeoms((

  SELECT * FROM [Drawing Table]

    ORDER BY [Z]

), TRUE);


As explained in the Example: Create a Drawing Dynamically from a Geocoded Table  topic, wrapping our simple query within a use of the TableCacheIndexGeoms function will automatically generate a spatial index for the Geom field.


Colors used in editing - Objects that are picked for editing, as well as paths drawn by the measurement tool and in editing, have their coordinate edit handles and boundaries shown using the same blue color used for previews and for provisional edits in other settings. If desired, we can change the preview and provisional color used by Manifold, as well as the red selection color used by Manifold, in the Tools - Options dialog.   This allows us to use different colors in cases where a visual display already uses very much blue or red color or to provide more discernible colors in case of color blindness.

See Also





Editing Drawings


Style: Drawings


Style: Thematic Formatting


Layers Pane


Info Pane


Example: Draw Lines, Areas and Points - Simple example of using basic mouse moves to add points, lines and areas to a drawing.


Example: Trace an Area in a Map over an Image Background - In a map with a drawing layer above an image layer, create an area object in the drawing by tracing over the outlines of something seen in the image layer below.


Example: Edit Coordinates While Creating an Object - When creating an object in a map using a tool such as Create Area, right in the middle of the process we can edit coordinates in the Info pane Coordinates tab.   This example shows the step by step process.


Example: Edit Attributes and Move a Point - We look at the attributes for a point in a drawing layer and edit one of the attributes using a more expanded Edit dialog.  We then move the point to a new location. Easy!


Example: Create a Multipoint - This topic provides two examples:  First we create a multipoint and then next we create a multipoint having two branches.  The purpose of this topic is to help teach the implementation of geometry in Manifold and other spatial packages using an unusual and rarely met object type, the multipoint, which combines what appear to be many separate points into a single multipoint object.


Editing Drawings - Create Areas - How to create areas (polygons) in a drawing.  We digitize a lake by tracing over a background satellite image layer from a web server.  This quick video shows how editing tools in Manifold make it easy to digitize objects very quickly, correcting any errors with no stress or fear of getting it wrong.  Includes a quick demo of snapping.


Editing Drawings - Create Lines with Curves - A very short video showing how to create lines in drawings using straight segments and also circular arcs.  We create a line in a map of Paris showing our walk around circular ponds. Manifold can create polylines using straight line segments for classic polylines, or using curved segments that are circular arcs, ellipses, or splines for very smooth curves, a much faster and easier technique than clicking many points.  Super!