Tuesday, December 28, 2010

Dynamic Graphics in GTViewer and GTVx


Version 10 of GTViewer and GTVx provides an exciting new feature called Dynamic Graphics which gives the user a powerful visualization tool for analyzing data, creating more informative or alternate views of data, and giving the user the ability to explore various decision making aspects of the data they already have. The Dynamic Graphics functionality uses a set of rules to generate new graphics on-the-fly from a variety of sources including a feature’s attribute values, the current zoom level, and even the presence of other dynamic graphics. The goal of the Dynamic Graphics functionality is to provide an easy way to generate thematic maps, feature labels, and analytical constructions in both an ad hoc manner or as prepackaged queries delivered with a dataset. The end result is data for your users that will enhance their productivity and ability to make decisions in the office or in the field.


The beginnings of the Dynamic Graphics functionality first appeared in Version 9 of GTViewer as the Dynamic Highlighter. This tool provided a significant amount of functionality for performing thematic queries whose results were shown by highlighting features meeting specified criteria. The highlight color was determined by one of the feature’s attributes value and looking up the value in a specified color map. The original purpose of the Dynamic Highlighter was to help identify a specific circuit on a map containing many circuits drawn in the same area all with the same style (color, weight, and linestyle). The Dynamic Highlighter gets a particular attribute on a feature, looks that value up in a color map (which maps a set of values to corresponding colors), and then highlights the feature in that color (appearing that the feature of interest changes color). Now, a single circuit in the view is easily identifiable amongst many other circuits. Color coding all circuits is also possible if an attribute is available to drive the color of the highlight. Many other applications of the Dynamic Highlighter quickly appeared such as showing circuit by phase, circuit by high or low voltage, gas pipes by pressure or material, and many more.

While being a very powerful tool, the Version 9 Dynamic Highlighter has some limitations. It can only look at a single attribute of a feature when determining the highlight color. Often, this single value was enough to do the job, but sometimes you needed several attribute values to determine the color or more complicated computations that go beyond a value lookup in a color map. Work-arounds for this problem are available, but they usually required creating a View in the GIS to create a single value for the highlighting task which hindered the “ah hoc-ness” of the functionality if the views were not already created. The interface for the Dynamic Highlighter was also a little primitive. Its rules could be defined as entries in the in the GTM file and methods were provided for External Applications to load new rules from a file. The Dynamic Highlighter was not supported in GTVx either. In the end, the Version 9 Dynamic Highlighter turned out to be more useful to the design of the new Dynamic Graphics functionality than it was to the Version 9 user base; nevertheless, it laid a down a good foundation for the next generation and greatly contributed to making Version 10 the best yet.

Dynamic Graphics

In Version 10 of GTViewer, the new Dynamic Graphics functionality provides a significantly enhanced version of the Dynamic Highlighter seen in version 9 plus a completely new Dynamic Labeler. A user-friendly Interface is also provided to configure the Dynamic Graphics rules. Now, users can quickly and easily create thematic queries or labels on-the-fly without the need to add entries to a configuration file or even need to know what the configuration files contain.

Dynamic Highlighting

The new Version 10 Dynamic Highlighter contains many new features:
  • One or more feature attributes can now be used in expressions to define a filter criteria which determines which features will get highlighted and to define a Map Value which will be used to look up the highlight style. Previously, only one feature attribute could be used and its value had to appear in the highlight style map.
  • The Highlighted Elements that get produced by the Dynamic Graphics are no longer limited to just being a different color. Weight and Linestyle can now be specified.

  • The Highlighted Elements can now be set to behave like regular elements in the Emphasize Session Graphics mode (which typically gray out when active). This ability to masquerade the highlighted elements as regular elements adds a new dimension to what can be done with highlighted elements since the original GIS features can be hidden and the Dynamic Graphics can provide an alternate view of the features.

  • The Dynamic Highlighter provides 2 modes of operation. The regular Highlight mode provides the full set of functionality utilizing a Color/Weight/Linestyle map to assign highlight styles according to an evaluated Map Value. A scaled down mode called Simple Highlight is also provided and simply highlights all features meeting the filter criteria using the same Color/Weight/Linestyle setting which eliminates the need to configure a Color/Weight/Linestyle Map for simpler Actions.

  • Dynamic Graphics is now supported in GTVx as well as GTViewer.

Dynamic Labeler

The Dynamic Labeler is the second half of the Dynamic Graphics functionality, and it does precisely what its name implies. The Dynamic Labeler generates labels for point, line, and area features using a set of rules. Depending on the type of label desired and the type of geometry it will be created for, many different options are available to specifying the label. The “Dynamic” in Dynamic Label pulls double duty since the labels are generated on-the-fly from the features in the current view, and can also take into account what parts of a feature is actually displayed in the view. For example, centering a label on a line that is 75% out of the view would likely produce a label you would not see since the center of the line would be outside the view, but the Dynamic Labeler can clip the geometry and only use the part that is in the view keeping the label displayed. Much more effective labels can be generated for an ever changing view. Our previous approach to generating labels that were not part of the source GIS was to use the GTLabelGtg tool (part of GTData) to build a nice set of labels for a dataset. These labels are static and will always be the same size and in the same relative position regardless of the view extents. The Dynamic Labeler can be configured to create similar static labels, but its power comes from its dynamic capabilities which simultaneously create more useful labels and a more aesthetically pleasing map view.

Dynamic Label Examples

To illustrate what the Dynamic Graphics functionality actually does, pictures are worth a thousand words.

The screenshot below shows 3 lines that use a Dynamic Label. In each line, the segment containing the mid-point of the line is found, then the mid-point of that segment is used as the origin for the label:

The Dynamic Labeling supports a Static placement mode (like GTLabelGtg would produce) and the screenshot below shows how the label behaves in the static mode when the lines are partially moved out of the current view:

The topmost line has its label go out of the view, and the bottom two lines have their labels moved to the edge of the screen.

In the screenshot below, the dynamic placement is active and the labels are placed more intelligently by only using the parts of the lines that are currently visible:

The example below shows a rotated "V" shape line that is fully in the current view. Here the line gets one label:

However, if the line is moved partially out of the current view, two separate lines are left and each gets a label of its own:

A more realistic example is shown below. Street centerlines are labeled with information from the database (the street name and street type) and a variety of rules are used to create a usable view: duplicates are removed, labels that overlap other labels are removed, and labels that are longer than the street segment they are associated with are removed.

In the screenshots below, the primary conductor feature is labeled with its Circuit Name, Phase, and Voltage in Red text:

Dynamic Labeling is not limited to lines. Both Point and Shape features are supported as well. The following screenshots show how Shape elements can take advantage of the dynamic label placement:

The topmost screenshot above shows two shapes in the current view with a Dynamic Label placed at the centroid. The lower left image shows how static labels will be have if the shapes are moved partially out of the current view, and the lower right image shows the same view with the dynamic positioning turned on (which uses the centroid of the visible parts of the polygons).

Dynamic Highlight Examples

A Dynamic Highlighting example is shown in the screenshots below where the gas main features are highlighted according to the feature's Pressure attribute values:

The topmost screenshot above shows the regular view of a gas network. The middle screenshot shows the gas network with Medium Pressure main colored Orange and Low Pressure main colored Blue. The bottom screenshot shows the highlighted gas mains with the emphasize mode turned on so that the Highlighted results are easier to see.

In the screenshot below, electric facilities are colored by their phase (A is Red, B is Green, C is Blue, and Orange is multiple).

No comments: