Example: Union Areas

In this example we combine multiple area objects into a single area by using the Transform dialog's Union Areas template for drawings.  A drawing of French regions shows some regions as more than one area.  We would like each region to be one area so the table of regions has one record per region.

 

eg_union_areas01_01.png

 

We open a drawing called Regions that shows regions in France as they were before the administrative reorganization of 2016, using area objects to represent regions.

 

eg_union_areas01_02.png

 

As we zoom into the region surrounding the region named Provence-Alpes-Cote d'Azur (henceforth in this topic, Provence), we see what appears to be a small island region within the adjacent  Rhone-Alpes region.

 

eg_union_areas01_03.png

 

We Ctrl-click onto the small island region and we also Ctrl-click onto the main Provence region to select both.

 

eg_union_areas01_04.png

eg_union_areas01_05.png

Opening the Regions Table we can choose Edit - Select  to use the Select dialog as seen above to preview the selection from the Regions window within the Regions Table in blue preview color.

 

That tells us that the selection in the Regions drawing window involves two separate objects, that is, two separate rows in the table.   Both the larger area conventionally known as Provence as well as the smaller island region within the Rhone-Alpes region are cited in the list as parts of the Provence-Alpes-Cote d'Azur region.   

 

What is going on is that the Provence region really does include a small, unconnected island portion of France that is the canton of Valreas, an isolated bit of Provence within the Rhone-Alpes region that is a relic of Papal holdings in the area dating back to the 14th century.

 

We would like to combine the canton of Valreas island portion of Provence with the main area of Provence into a single area object.  That is easy using the Union Areas template.

 

With the focus on the Regions drawing, where the two areas for Provence already have been selected, we choose Edit - Transform to launch the Transform dialog.    The dialog launches with the Geom field for the Regions drawing already loaded as the Target.  

 

eg_union_areas01_06.png

 

We check the Restrict to selection box and then choose Union Areas.    Before proceeding we click on the Options button to confirm all Transform options are the way we want.   

 

eg_union_areas01_07.png

 

New components using the name Regions Table Union Areas will be created.  We can live with that.   We confirm all of the other fields will be transferred as we want.   We press OK.

 

eg_union_areas01_08.png

 

Back in the Transform dialog we confirm once more that the Restrict to selection box is checked, since we want to union only the two selected areas and not combine all areas in the drawing into a single area.   We press Add Component and then, since we won't be using the Transform dialog again, we press Close.

 

eg_union_areas01_09.png

Manifold swings into action and creates the results of the template as two new components, a table and a drawing that shows the objects in that table, using the names specified in the Options dialog.

 

eg_union_areas01_10.png

If we open the Regions Table Union Areas Drawing we see that does indeed contain the two parts of the Provence region.

 

A Ctrl-click anywhere in the larger part will select both parts, proving that both parts are now parts of the same area object.

 

We will now switch back to the Regions drawing, by clicking on the title bar to move the focus there.   The drawing is as we left it when we launched the Transform dialog.   The two area objects that represent the two parts of the Provence region are still both selected.

eg_union_areas01_11.png

 

We press the Delete key or Edit - Delete to delete the objects.

 

eg_union_areas01_12.png

 

When we delete the selected objects they disappear both from the drawing and, of course, from the table.   Deleting an object in a map means deleting the record for that object in the table for which the drawing shows data.

 

eg_union_areas01_13.png

The illustration above shows the Regions Table with the two records for Provence deleted.   We will now copy and paste into the table the new, single record for Provence that was created by the Union Areas transform.

 

Double-click on the Regions Table Union Areas in the project pane to open it.

 

eg_union_areas01_14.png

 

There is only one record because there is only one object in that table.   Ctrl-click on the row handle for the record to select it.

 

eg_union_areas01_15.png

Press Ctrl-C to copy the selected record.

 

Next we switch back to the Regions Table so we can paste the copied record.

 

eg_union_areas01_16.png

Press Ctrl- V to paste the copied record off the clipboard and into the table.

 

eg_union_areas01_17.png

A new record appears in the table for Provence.    Instantly, as soon as we paste the record, the drawing also updates to show the new object that was added.

eg_union_areas01_18.png

 

We can prove that the "island" of Valreas and the main portion of Provence are now a single area object by ctrl-clicking anywhere in the main portion of Provence to select the object.

 

eg_union_areas01_19.png

 

Both the main portion and the island light up in selection color to show that a single Ctrl-click on either selects both.  

 

The theme of this example continues in a related example, in the SQL Example: Learning to Union Areas in SQL from Edit Query topic.

 

Notes

Old Data - The illustrations in this topic use data from the US military, which show the regions of France as they were before 1 January 2016, when a law passed in 2014 took effect that reduced the number of regions in France from 22 to 13. 

 

The canton of Valreas - The island portion of Provence within the Rhone-Alpes region derives from 14th century Papal holdings when the Popes were resident at Avignon.  Pope John XXII purchased Valreas in 1317 and Pope Clement VI added to the Papal properties around Valreas to form what is now the territory of the canton.   To this day the canton is more popularly known by locals as the Enclave des Papes, the enclave of the Popes.

 

The papal enclave surrounding Valreas remained part of the Papal estates until the French Revolution, when in 1791 as the Departments of France were first being organized in the wake of the revolution the residents of the enclave in a referendum chose to be part of Vaucluse in Provence, thus creating an island enclave of  Provence  within the territory of a different department.

 

In modern times the canton retains its ancient fame for Côtes du Rhône wines, truffles and lavender.

See Also

Transform Dialog

 

Transform Options

 

Transform Templates

 

Transform Templates - Drawings

 

Transform Templates - Geom

 

Transform: Overlay

 

Transform: Overlay Topology

 

Example: Two Drawings from the Same Table - Take a table with a geom field that is visualized by a drawing.  Add a second geom field to the table and create an rtree index on that field so it can be visualized by a drawing.   Copy the first drawing, paste it and adjust the pasted copy so it uses the second geom field. Demonstrate how to use the Transform dialog to show "live" modifications in the second drawing compared to the first drawing.

 

Example: Copy one Column into Another Column with Transform - How to use the Transform dialog 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 Dialog -  How the Expressions tab of the Transform Dialog may be used to change the values of fields.   We include an example of changing the price of selected products and using two different Transform dialogs open at the same time for two different table windows.

 

Example: Overlay Contained -  A frequent use of overlays is to sum the values of many points that fall within an area and to transfer that sum to a new field for an area.  In this example we take a drawing that has cities in the US with a population value for each city.  We use Overlay Contained  to sum the population of each city within a state and to transfer that sum to a total population for the state.

 

Example: Overlay Containing - One of the most common uses of overlays is to transfer fields from areas to points that are contained in those areas.    Tasks such as transferring a census block group number or zip code number from a drawing of areas to points that fall within each area are extremely common.   In this example we transfer the name of a French region  to the points that represent cities which fall within each region.

 

Example: Transfer Options and Merge Areas - Using the Merge Areas Transform dialog template, an exploration of the difference between using Copy and Sum for transfer options.

 

SQL Example: Learning to Union Areas in SQL from Edit Query - We learn how to write an SQL query that does a custom Union Areas operation by cutting and pasting from what the Edit Query button automatically generates.

 

Example: Construct JSON String using Select and Transform - Use the Select and Transform dialogs 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 Dialog Templates -  In this example we open a drawing and edit objects in the drawing using the Transform dialog Template tab.   Includes examples of using the Add Component button and also the Edit Query button.

 

Example: Use a Transform Dialog Expression to Create Buffers in a Drawing - Use the Expression tab of the Transform Dialog 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.

 

Example: Clip Areas with a Transform Dialog Expression - Use the Expression tab of the Transform dialog to clip areas in a drawing to fit within horizontal bounds.   Includes examples of using the Add Component button and also the Edit Query button.

 

Example: Smooth Lines with a Transform Dialog Expression - Use the Expression tab of the Transform dialog to make lines smoother in a drawing so that longer lines are smoothed more.  Includes examples of using the Edit Query button to show how different queries are created automatically depending on if we want to update a field or to add a new component.