Example: Union Areas

In this example we combine multiple area objects into a single area by using the Transform pane'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.


 User interfaces for the Transform pane have been changed.  See the Transform Reference topic for guides to new interfaces while this topic is updated.   This topic would now be done using the Merge transform, using the areas (dissolve) option.



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.



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.



We zoom further in and then Ctrl-click onto the small island region to select it.



We also Ctrl-click onto the main Provence region to select that as well.



We can take a look at the selected records by opening the drawing's table.



Opening the Regions Table we see that two records have been selected that correspond to the two areas selected in the drawing.


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 launch the Transform pane.



The pane launches with the Geom field for the Regions drawing already loaded as the Target.  We enter union into the filter box to reduce the long list of transforms to only a few, from which it will be easier to pick out the template we want.   We check the Restrict to selection box and then choose the Union Areas template.



As soon as we choose the template the system will preview the objects to be affected in blue preview color.



Before proceeding we click on the Options button to confirm all Transform options are the way we want.   



In the Transform Options dialog we see that 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.



Back in the Transform pane 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.



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 Transform Options dialog.



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 pane.   The two area objects that represent the two parts of the Provence region are still both selected.



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


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.



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.



There is only one record because there is only one object in that table. If the area in Regions Table Union Areas Drawing is still selected, the record in the table will also be selected.   If it is not selected, we Ctrl-click on the row handle for the record to select it.



Press Ctrl-C to copy the selected record.


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



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



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.



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.



Both the main portion and the island light up in red 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.


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 the Departments of France were first organized.  In 1791 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 Pane


Transform Reference


Topology Overlays


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.


Example: Copy one Column into Another Column with Transform - How to use the Transform pane 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 Pane - How the Expressions tab of the Transform pane may be used to change the values of fields.  


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.


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 pane and the Transform pane 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 pane 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 pane 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 Expression - Use the Expression tab of the Transform pane 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 Expression - Use the Expression tab of the Transform pane 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.