Example: Formatting Tricks

 

Example: Formatting Tricks

The visualization capabilities of Manifold using the Style panel can be exploited to provide many visual effects.  This topic provides some examples of how to use Style in unexpected ways to create a range of more elaborate effects.   By presenting miscellaneous techniques we can stimulate creativity in using Style.

 

The key idea for most of these tricks is to make duplicates of data so that multiple versions of the same data can be stacked as layers in a map with each drawing formatted differently and, if necessary, offset using the Shift template in the Transform panel.   tech_tina_sm.png

 

Important: While there are effects that can be achieved by using multiple drawings based on the same table with each drawing formatted differently, when we use Shift we must make sure to copy both the table and the drawing so that what is shifted is a different data set from the original.

 

The examples below assume we are familiar with using the Style panel to change formatting in drawings.

Using Rotation to Create Diamonds and Inverted Triangles

We can use the  Point rotation property in the Style panel to create custom effects for point symbols.

 

il_spatial_overlay01_05.png

 

The three illustrations below show the same drawings as the illustration above, but with default formatting altered by using the Style panel and overall background color set using Contents - Layers.

 

il_format_eg01_01.png

 

In the above illustration thematic formatting is used to control the Point rotation of the point symbols, with thematic formatting also used to specify the background color of areas.  Contents - Layers was used to set black background color for the drawings.

 

il_format_eg01_02.png

 

In the above illustration points are all set to use the same icon and color, with thematic formatting also used to specify the background color of areas.  Contents - Layers was used to set light beige background color for the drawings.  This illustrates how the square icons look without rotation.

 

il_format_eg01_04.png

 

In the above illustration when square icons are used for points but with a Point rotation of 45 they appear as diamonds.  Area borders are set to use a dotted line style and the same color is used for all areas.   Contents - Layers was used to set light blue background color for the drawings.

 

il_format_eg01_03.png

 

In the above illustration all points use a Point rotation of 180 degrees to flip the default triangle style used for points,

 

Using Shift to Create a Drop Shadow

We will create a drop shadow effect to give the appearance of three dimensionality to areas seen in a map.    This is a limited effect as it tends to look best in only a limited range of zoom levels, but for that limited purpose it looks very good.

 

We begin with a drawing called Regions of the regions of France shown as areas, seen in a map below.   We have used the Layers panel to set the background color to a calm beige.

 

eg_format_tricks01_01.png

 

In the Project pane we ctrl-click on the Regions drawing and we ctrl-click as well on the Regions Table 2 used by the drawing to highlight both components.  

 

eg_format_tricks01_02a.png

We then press Ctrl-C to copy both.

 

eg_format_tricks01_02.png

We press Ctrl-V to paste and two new components, copies of the ones we copied, appear in the Project pane named Regions 2 and Regions Table 2.  The properties for the Regions 2 drawing have been automatically adjusted so it uses the Regions Table 2 table.

 

eg_format_tricks01_03a.png

 

We drop the new Regions 2 drawing into the map.   Since it is an exact copy, including formatting, of the Regions drawing there is no visual change in the map.  With the Regions 2 the active layer, in the Contents pane we choose the Style panel.

 

 

eg_format_tricks01_03b.png

 

We use the Style panel to change the color and fill color for areas to black.

 

eg_format_tricks01_03.png

 

The Regions 2 layer now appears as a completely black display.   It exactly covers the Regions drawing underneath.

 

eg_format_tricks01_04.png

 

We drag the Regions 2 layer tab to the right, so the Regions 2 layer is rendered below the Regions layer.   The Regions 2 drawing is a copy of the data in the Regions drawing so the two line up perfectly and the Regions 2 drawing cannot be seen since it is under the Regions drawing layer.

 

We click the Regions 2 layer tab to ensure the Regions 2 drawing is the active drawing.  In the Contents pane we choose the Transform panel.

 

eg_format_tricks01_05.png

 

We choose the Shift template and use Shift X and Shift Y values of 10000 and -10000 respectively.   This moves the Regions 2 drawing down and to the right relative to the Regions drawing by the specified amount.

 

eg_format_tricks01_05a.png

 

Manifold immediately shows a preview using blue preview color to show how the Regions 2 objects will be shifted.   How do we know the right amount to use?   We can experiment and see what the preview looks like in the map.  We press Update Field.

 

eg_format_tricks01_06.png

 

The map updates and we see that the lower drawing, the all-black Regions 2 drawing, has been shifted to the right and down, thus providing a 3D-like effect of a drop shadow or solid edge, as if the areas were cut out of some material with thickness.

 

eg_format_tricks01_06a.png

 

We can see how the technique works by zooming far into the upper edge of the areas.   The lower, black layer has been shifted relative to the upper layer.   The effect breaks down when the display is zoomed too far into the scene but it works remarkably well to generate screen shots that can later be utilized in graphics editors.

 

We can also extend this technique by using additional layers.

 

eg_format_tricks01_06b.png

 

In the illustration above, zoomed in slightly to show the effect better in a small illustration, we have made two more copies of the Regions drawing and in both we have deleted all areas but the area for the Centre region.  The lower Centre 2 drawing has been formatted with black fill color and gray outline color.   The upper Centre drawing has been formatted a light green and then Shifted upwards by 10000 Y units and to the left by -10000 X units.  The result emphasizes the Centre region as if it has popped out from the other regions.

Stacking Styles to Create Custom Symbology

When we do not need to use Shift we can simply make copies of drawings to have multiple drawings that use the same table.  Each drawing can be formatted differently, as shown in the Example: Style Properties in the mfd_meta Table topic.   See also the Example: Style Panel Quickstart topic.

 

We first create a custom point symbol by stacking two copies of the same drawing but formatted with different point styles.

 

eg_format_tricks01_07a.png

 

The Some Cities drawing has points formatted as large, round, all-black symbols.

 

eg_format_tricks01_07b.png

 

The Some Cities 2 drawing has points formatted as smaller white squares.

 

eg_format_tricks01_07.png

 

When both layers are seen together the result is a symbol for points that appears to be a square within a larger black circle.

 

We can do the same effect by stacking drawings with lines.

 

eg_format_tricks01_10.png

 

The Some Lines 2 drawing has lines formatted as thick, solid all-white lines.

 

eg_format_tricks01_11.png

 

The Some Lines  drawing has lines formatted as thinner, dotted white and gray lines.

 

eg_format_tricks01_12.png

 

When both layers are seen together the result is a custom appearance for a line that looks like a white roadway with a dotted center line.

 

By combining thicknesses, colors, line styles and two or even more layers we can create a wide range of visual effects for lines.

 

eg_format_tricks01_13.png

 

The above example uses a lower layer with all-black thicker lines and an upper layer with all-green thinner lines.

Offsetting Labels

The display will be more legible if labels are offset from points so they do not cover or are not covered by the points.  With a bit of tinkering that is easy to accomplish.   We first make a copy of both the points drawing we will use and also the table for that points drawing.

 

eg_format_tricks01_08.png

 

In the above illustration we have copied the Some Cities drawing along with the Some Cities Table that it uses.  We then renamed the newly copied drawing Cities Labels, formatted the points so they are big circles with transparent Color, background value and then using the Shift technique from the first example in this topic we shifted those points upwards to the distance seen in the illustration.   

 

eg_format_tricks01_08a.png

 

When we create labels using the Cities Labels drawing those labels will be centered on the big transparent circles and not on the original points.  When we copied and pasted the Some Cities drawing along with the Some Cities Table that drawing uses, we also carried along a copy of all the other fields, such as the names of cities, in addition to the geom field that gives the location of the points.  So the names used to create labels correspond perfectly to the points above which they have been offset.

 

eg_format_tricks01_09.png

 

If after creating the labels we remove the Cities Labels layer (or, just double-click its tab to turn it off) we have the display we want, labels for each of the Some Cities points but offset from the points so that the label or the point icons do not obscure each other.

Multiple Drawings from the Same Table

Usually, the best way to create multiple drawings that can be stacked for desired display effects is to base those drawings all on the same geom field in the same table.    We can also create computed fields within the same table that cast our drawing objects dynamically into different form, such as creating border lines from areas, which can then be stacked for desired visual effects.

 

eg_format_tricks01_14.png

 

Consider our example Regions drawing, seen above in a slightly zoomed in view.  We right-click onto the Regions tab and choose Open Table.

 

eg_format_tricks01_15.png

 

The table for the drawing shows the Geom field, which contains geometry for each area object that appears in the table.    We choose Edit - Schema to launch the Schema dialog.

 

eg_format_tricks01_16.png

 

In the Schema dialog we press <new field> and then in the Field box we enter a name for the new field, which we will call GeomBorder.  We choose geom as the Type.   We would like to create this field as a computed field, so we enter the expression

 

GeomConvertToLine([Geom])

 

into the Expression box.   The expression uses an SQL function to take the Geom field and to convert that geometry from an area into a line.  We press Add to add the computed field to the schema.  We then press OK to close the Schema dialog.

 

eg_format_tricks01_17.png

 

We have created a new field in the table, called GeomBorder, which is a computed field that generates line geometry from the area geometry in the Geom field.  

 

In the Project pane we right-click onto the Regions Table and we choose Create - New Drawing.

 

eg_format_tricks01_18.png

 

In the New Drawing dialog we enter Regions Border as the Name.   We choose the GeomBorder field to use for Geometry.   The dialog knows there is no spatial index, as yet, created on that field in the table, so it offers to create a spatial index for us.     The dialog warns, using red text, that no coordinate system has been assigned.   We know the Geom field from which the GeomBorder field is calculated uses Pseudo-Mercator,  so we will click the coordinate picker button and choose Pseudo-Mercator from the menu as the coordinate system to be assigned.   We press the Create Drawing button.

 

eg_format_tricks01_19.png

 

Next, we drag and drop into the map the new Regions Borders drawing we have just created.

 

eg_format_tricks01_20.png

 

Using the Style panel, we increase the size of the lines in the Regions Borders drawing to 2 points.

 

eg_format_tricks01_21.png

 

The result is thicker border lines.

 

If we like, we can create another drawing from the borders geom.   That will take zero extra storage.   In the Project pane we right-click onto the Regions Table drawing and choose Create - New Drawing once more.

 

eg_format_tricks01_22.png

 

In the New Drawing dialog we choose a name of Regions Borders2 for the new drawing.  We choose the GeomBorder field to use for Geometry.   There is no need to assign the coordinate system since the dialog now knows that the GeomBorder geometry field contains geometry using the Pseudo-Mercator coordinate system we previously assigned.   We press Create Drawing.

 

eg_format_tricks01_23.png

 

We drag and drop into the map the new Regions Borders2 drawing.   If we change the style to use white color and a thinner line for the lines in the Regions Borders2 drawing, as seen below in the Style panel, the effect of Regions Borders2 overlaid onto Regions Borders is a border that consists of a white line within black edges.

 

eg_format_tricks01_24.png

 

What we have done above is exploit Manifold's ability to create multiple drawings from exactly the same geometry field in the same table, and to style each of those drawings differently.   The Regions Borders drawing uses a thicker black line while the Regions Borders2 drawing uses a thinner white line that fits within the thicker black line in the layer below.

 

We can specify more intricate formatting for the lines in the Regions Borders2 drawing:

 

eg_format_tricks01_25.png

 

We achieve the effect above by using a dotted line style.

 

eg_format_tricks01_26.png

 

In the Style panel as seen above, we have used green fill color with a dotted line style for Regions Borders2.   The effect when seen against the thicker black line in the layer below provides a dot-dash, white / green line with black edges.

 

We can use formatting in the border line layer to achieve different effects in combination with area styles in the layer below.

 

eg_format_tricks01_27.png

 

In the illustration above, we have used the Layers panel to specify a dark gray background for the map, taking a moment to save that dark gray color to a custom color well in the Windows color picker dialog.  In the Regions layer we use a thematic format for area foreground color, transparent color for area fill color, and diagonal hatch patterns.   We then used that same custom, dark gray color as the line color for a thicker line in the Regions Borders layer.   The result is to give the appearance of area hatch patterns that do not have a border, but which just consist of diagonal hatch lines.   Because the upper, border lines layer is the same color as the background, it appears to "knock out" what otherwise would be brighter colored area boundaries.

 

We can create a second drawing from the area geom in the Regions Table, and then use that second drawing to create new visual effects in combination with the Regions drawing.

 

In the Project pane we right-click onto the Regions Table and then choose Create - New Drawing.  

 

eg_format_tricks01_28a.png

 

We specify Regions Hatch as the Name for the new drawing, accept the default choice of Geom for the Geometry field and then we press Create Drawing.

 

eg_format_tricks01_28.png

 

We drag and drop the Regions Hatch drawing into the map.    Using the formatting shown below, it provides an appearance of dotted lines for area fill.   We have also colored the Regions Borders lines in a pale blue.

 

eg_format_tricks01_29.png

 

The Style pane above shows formatting for the Regions Hatch layer.   The area foreground color is the same dark gray color used for the background, so the hatch lines used for areas in that layer will be the same color as the background.   The fill color is transparent.    The hatch pattern used is a thematic format where the left or right diagonal patterns have been chosen to be opposite to those used in the thematic format for the Regions layer areas.     The result is that the intersections between the hatch patterns in the Regions layer below and the Regions Hatch layer above are "knocked out" with background color, resulting in a dotted line effect.

 

eg_format_tricks01_30.png

 

We can create a variety of intricate effects by combining hatch patterns.    The illustration above uses thicker white lines for borders.   The Regions Hatch layer uses formatting as seen below at left , where a diagonal cross hatch pattern is used for all areas.   The Regions layer below uses a checkerboard hatch pattern with brighter colors.    Where the upper, diagonal hatch pattern in background color intersects the lower checkerboard pattern, the brighter colors of the lower layer are knocked out with background color.  

 

Note that both hatch patterns use the same size, of 6 points.   Such effects usually work best when the different layers use exact multiples of sizes.

 

eg_format_tricks01_32.png  eg_format_tricks01_31.png

 

If we reverse the hatch patterns used by the layers, with the upper Regions Hatch layer using a checkerboard hatch and the lower Regions layer using a diagonal crosshatch pattern, we get the effect seen below.   The illustration below also alters colors used, including the background and border.

 

eg_format_tricks01_33.png

 

Change the lower Regions layer hatch pattern to a left diagonal hatch, and we get yet another effect, as seen below.

 

eg_format_tricks01_34.png

 

Notes

Historical regions - The illustrations in this topic use data from the US government, which show the regions of France as they were before 1 January 2016, when regions in France were reduced from 22 to 13.

 

Wasteful of Storage? - When drawings are created using the same geom in the same table they require essentially zero extra storage.   We can style each drawing differently to get the effects seen above.  

 

Take it easy - Stacking layers using different formats is a great way to create useful effects but, when overdone, can result in ugly and confusing displays.  Use with restraint.

 

See also

Getting Started

 

User Interface Basics

 

Maps

 

Editing Tables

 

Drawings

 

Style

 

Style: Drawings

 

Example: Style Panel Quickstart - A tutorial introduction to using the Style panel in the Contents pane to apply color, symbology, size and rotation to areas, lines and points in drawings.

 

Example: Format a Drawing using the Style Panel - In this example we provide a first, step by step look at how to format areas in a drawing using the Style panel.  We can specify the same formatting for all areas or use a field to automatically set formatting, a process usually known as thematic formatting.

 

Example: Format the Size of City Points by Population - A common GIS task is to format the size of points in a drawing based on some value.  For example, the size of points that represent cities might be formatted based on the value of the city's population, with cities that have larger populations being marked by larger point icons.  This is an example of thematic formatting and is easy to do using the Style panel.

 

Example: Add, Delete and Edit Thematic Formatting Intervals - This topic provides a step by step example of adding, deleting and editing intervals in the Style panel that are used for thematic formatting.

 

Example: Style Properties in the mfd_meta Table - Style properties for drawings such as colors for areas are stored in human readable JSON values as properties in the mfd_meta system table.   This example shows how we can copy formatting from one drawing to another by simply copying values between records in the mfd_meta table.

 

Example: How Not to Format a Drawing -  When using Style to format a drawing it is a really bad idea to use the same color for objects that is used for the background color.    It can also be a bad idea to use transparent color.   This topic illustrates why.