Example: Two Drawings from the Same Table

For the simple case of creating two drawings from the same table, both of which drawings use the same geom field, please see the Example: Multiple Drawings from the Same Table topic.

 

This example has three objectives:

 

 

In this example we take a table with a geom field that is visualized by a drawing.  We add a second geom field to the table and create an rtree index on that field so it can be visualized by a drawing.   We copy the first drawing, paste it and adjust the pasted copy so it uses the second geom field.   We demonstrate how to use the Transform panel to show "live" modifications in the second drawing compared to the first drawing.

Transform Panel and Tables

The Transform panel operates on whatever open component has the focus when the Transform panel is launched.  For example, if we open a table window and then click on the Contents pane and choose the Transform panel, the panel will operate on that table.  The Transform templates available will be those which make sense for that table and for the specific field within the table chosen as the target field.  Whatever previews in blue preview color the panel does will be done within that table, showing the result that would happen to the target field.

 

Such previews will not be passed on and displayed in other components.  For example, a preview in a table for a transform template will not also create a preview in a drawing window that visualizes data from a geom field in the table.   That is because the preview is just a preview, not a change in the actual table data.  Other components, like drawings, which display the actual data in the table will continue to display the actual data.   If we want other components to change we must change the actual data which they display.

 

We could always open the drawing and click on a template in the Transform panel to see a preview in the drawing; however, sometimes we are working within the drawing's table and not in the drawing.    We would like to see what a transform will do to a drawing even though we are working in the table.  We might want to  experiment with data in a table but at the same time we might also want to see what changes such experimentation causes in other components, such as drawings, which depend upon data in the table.   That is easy to do.

 

If we want to experiment with changes to a geom field without actually changing the geom field, we simply create an additional geom field that can function as a copy of the geom field or as a temporary scratch pad to hold changed versions of the geom field.  We can then create a drawing that uses the additional geom field.  We can then make changes to the copied geom field to see what happens.

 

In this example we use a name of Tgeom (a mnemonic for "Temporary Geom")  for that temporary scratch pad field.   We can then create a second drawing, which in this example we name Tgeom Drawing, shows whatever is in Tgeom.    We can then use Tgeom as the target field for Transform templates, using Geom as the source field and we can press Update Field to actually change the data within Tgeom so that any components, like Tgeom Drawing, which utilize that field can update as well.

 

Geom never gets modified: it is just the source field from which data is copied or which is used to feed the Transform template that puts data into our temporary scratch pad field, Tgeom.   That allows us to try out as many templates as we like to see what effect they have on Tgeom in the preview in the table, and then, by pressing Update Field to update Tgeom to see what effect they have on the Tgeom Drawing.

 

At any time when we are done experimenting we can fill Tgeom full of NULL values again or simply delete that field as well as the temporary, Tgeom Drawing that showed its contents and the table will be back to the way it was originally, with Geom completely unmodified.

Transform Panel and Drawings

When a drawing is open and has the focus, clicking on the Contents pane and choosing the Transform panel, the panel will operate on that drawing.   Fields that are available in the panel will be fields in the table from which the drawing takes its geom data for visualization.    In many cases, the Transform templates that are available to work on those fields will be the same as those that are available when the drawing's table is the context for the Transform panel.  

 

When a Transform panel is opened in the context of a drawing any previews the Transform panel causes will be shown in the drawing.   We can exploit that effect to see what a particular template does to objects in the drawing using the preview without any need to press the Update Field button.

 

Important: The Transform panel can show previews for its work in a drawing if there is at least one object in the drawing.   Drawings can not host previews if they are empty, that is, where there are no records in the associated table or where the values for all records in the geom field the drawing uses are NULL values.  That is true even if the preview would involve filling the NULL values with non-NULL geom values.

 

Examples Using the Transform Panel and a Table

Our project has an Objects table and an Objects Drawing.

 

eg_two_drawings01_01.png

 

We open the Objects Drawing, zoom to fit, and then zoom out one click on our wheel mouse so that all objects are visible.

 

eg_two_drawings01_02.png

 

We open the table.   There are three areas, two lines and two points in the table.  

 

eg_two_drawings01_03.png

 

To add another field we choose Edit - Schema to open the schema for the table.

 

eg_two_drawings01_04.png

 

 

We choose a Field name, Tgeom, and a Type of geom, for the new field and then we press the Add button to add the new field to the schema.  We then press OK to exit the Schema dialog.

 

eg_two_drawings01_05.png

 

The result is that a new geom field called Tgeom has been added to the table.  So far it is filled with NULL values.    

Create a Second Drawing using the Same Table

We will now create a second drawing to use the new Tgeom field.

 

eg_two_drawings01_06.png

 

In the Project pane we right-click on the Objects table and then in the context menu we choose New Drawing.

 

eg_two_drawings01_07.png

 

In the New Drawing dialog we Name the new drawing Tgeom Drawing.   The dialog is already loaded with the Objects table and the geometry fields in the table.  In the Geometry box we choose Tgeom.

 

eg_two_drawings01_08.png

 

 

eg_two_drawings01_09.png

 

 

 

eg_two_drawings01_10.png

 

 

 

The dialog knows there is already a spatial index on the Tgeom field (if not, the dialog could create a spatial index on that field for us).  We press Create Drawing.

eg_two_drawings01_11.png

The new drawing appears in the Project.  To open it we can double-click on the Tgeom Drawing.

 

eg_two_drawings01_12.png

When we open the Tgeom Drawing it shows nothing, because the drawing now uses a field, Tgeom, within the Objects table that as yet is full of NULL values.

 

Populate the Tgeom Field

We will now populate the Tgeom field using the Transform panel to put values into the Tgeom field based on existing values in the Geom field.   

 

With the focus on the opened Objects table, we click on the Contents pane and choose the Transform panel.

 

eg_two_drawings01_13.png

 

In the Transform panel we choose Tgeom in the upper box as the target field, we click on the Copy template to choose that template and then we choose Geom in the lower box as the source, value field.

 

When we press Update Field, the values for each record in the Geom field will be copied into the Tgeom field.

 

eg_two_drawings01_14.png

 

To see the objects in the open, Tgeom Drawing we right-click on the layer tab and choose Zoom, or we can press the Zoom to Fit button on the main toolbar.  We then use the mouse wheel to click out one zoom level to provide a bit of empty margin, to ensure any points on the periphery of the drawing are better in view.  The view is identical to what we see in the Objects Drawing because the objects now in the Tgeom field that the Tgeom Drawing window shows were copied from the Geom field that the Objects Drawing window shows.

 

eg_two_drawings01_15.png

 

Using Tgeom as the target field and Geom as the source field we can choose different templates in the Transform panel and as we click Update Field the results of the transform will be put into the Tgeom field and the Tgeom Drawing automatically will show them.

 

eg_two_drawings01_16.png

 

For example, we can choose the Buffer template with a Distance of 5.

 

eg_two_drawings01_17.png

 

The Tgeom column in the table will be drawn in blue preview color to show that field will be affected.   When we press the Update Field button the Tgeom field will get updated.

 

eg_two_drawings01_02.pngeg_two_drawings01_18.png

 

We can see the results in an immediate comparison if we leave both the Objects Drawing and the Tgeom Drawing open next to each other at the same time.

 

eg_two_drawings01_19.png

 

Increasing the Distance to 15 while still using Buffer and then pressing Update Field shows us what effect increasing the Distance has on the objects created by the Buffer template.

 

eg_two_drawings01_02.pngeg_two_drawings01_20.png

 

The greater Distance means the borders of the buffer areas are created further away from the edges of the objects from which they are created.

 

eg_two_drawings01_21.png

 

Choosing Convert to Point and pressing Update Field shows how the template creates points at the locations of coordinates which define objects in the source field.

 

eg_two_drawings01_02.pngeg_two_drawings01_22.png

 

Since we are using the Transform panel with Geom as the source field and Tgeom as the target field the Geom field is not modified.   Only the Tgeom field is modified.

 

eg_two_drawings01_23.png

 

For our last example we will click on Enclosing Rect and press Update Field.

 

eg_two_drawings01_02.pngeg_two_drawings01_24.png

 

The result is to place into Tgeom area objects which are the enclosing boxes for line and area objects in the source geom field, that is, the minimal sized rectangular areas that full enclose the source objects.  Points are replaced with a pseudo-area that has all four coordinates at the same location, and which is indicated by small square symbols.

 

Examples Using the Transform Panel and a Drawing

Let us re-start the above example from the point where we had a blank Tgeom Drawing.   If we have been experimenting with this example and the Tgeom field is not empty, that is, full of NULL values, we can fill it with NULL values by using the Copy template with a Value of Null and pressing Update Field.

 

eg_two_drawings01_25.png

 

With the drawing open and the focus on the drawing we click on the Contents pane and choose the Transform panel to operate on that drawing.

 

Drawings which are empty cannot show previews so our first order of business is to copy the Geom field contents into the Tgeom field so the Tgeom Drawing has something to show:

 

eg_two_drawings01_26.png

 

We press the Update Field button since we want to actually change the data in Tgeom to values other than NULL.

 

eg_two_drawings01_27.png

There, that is better!   The drawing can now preview what we do in the Transform panel.

 

 

eg_two_drawings01_28.png

 

When we click on the Bounds template in the Transform panel (partial view above), right away the system previews the result in the drawing.

eg_two_drawings01_29.png

 

The Bounds template (see the Transform Templates - Geom topic) puts a point at the start and the end of each line and draws a line around the outer boundary of each area.   It replaces points with NULLs.

 

eg_two_drawings01_30.png

 

Click on the Convert to Point template and the drawing window immediately previews the points it creates.

 

eg_two_drawings01_31.png

As noted in the Notes to the Transform panel topic, the points created by Convert to Point are multipoints.

 

See Also

Contents Pane

 

Transform

 

Contents - Transform

 

Transform Options

 

Transform Templates

 

Transform Templates - Drawings

 

Transform Templates - Boolean

 

Transform Templates - Datetime

 

Transform Templates - Geom

 

Transform Templates - Numeric

 

Transform Templates - Text

 

Example: Drawings use Geom Fields in Tables  - An essential discussion on how drawings are created from geom fields in tables, including how the drawing knows which coordinate system to use.

 

Example: Multiple Drawings from the Same Table - Illustrates how easy it is to create multiple drawings that use the same table and same geometry by copying and pasting an existing drawing.  Each new drawing takes no additional storage space in the project, but can be formatted differently.   

 

Example: Create a Drawing from a Geocoded Table - A geocoded table has records with a latitude and longitude for each record.   This example starts with a table containing a list of cities with a latitude and longitude field for the location of each city.   We create a geom from the latitude and longitude fields using a template in the Transform panel and then we create a drawing that shows the cities as points.  This example shows all the infrastructure steps involved.

 

Example: Copy one Column into Another Column with Transform - How to use the Transform panel to copy the contents of one column in a table into another column, but only for selected records.  Uses the Products table from the Nwind example data set.  

 

Example: Transform Field Values using an Expression in the Transform Panel - How the Expressions tab of the Transform panel may be used to change the values of fields.  

 

Example: Construct JSON String using Select and Transform - Use the Select panel and the Transform panel to manually construct a JSON string using values from other fields in a table. Shows how we can manipulate text to build desired contents in a field.

 

Example: Edit a Drawing with Transform Templates - In this example we open a drawing and edit objects in the drawing using Transform panel templates.  Includes examples of using the Add Component button and also the Edit Query button.

 

Example: Use a Transform Expression to Create Buffers in a Drawing - Use the Expression tab of the  Transform panel to create three different sizes of buffers for different lines in a drawing and then automatically create a query which does the same thing.  Includes examples of using the Add Component button and also the Edit Query button.