Example: Overlay Contained

To explore the use of Overlay templates in the Transform dialog we consider a quick tutorial example, using 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.  We may wish to sum the total sales for all customers in a given sales region and transfer that total sales amount to a new Sales field in a drawing of regions.

 

Overlay templates alter fields in the drawings upon which they work, in contrast to Overlay Topology templates which alter objects in the drawings upon which they work.

 

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.

 

eg_overlay_contained01_01.png

 

We open a map that has two drawings as layers.  One drawing shows US cities as points.   The other drawing shows US states as areas.  We click on the US states tab to make that the active layer.  The US states drawing will be our target drawing and the US cities drawing will be our overlay drawing.

 

eg_overlay_contained01_02.png

If we open the US states Table we see that it has a name for each state.  We would like to add a population field that is the sum of the populations for each city that is contained within the state.

eg_overlay_contained01_03.png

Opening the US cities Table we see that each city has a Population value.   If we sum the Population values for each city contained within a state that is the value we would like for a new Population field for the state.    We will use the Overlay Contained template to do that.

 

We click on the US states tab in the map to ensure the US states drawing is the active drawing.  We then choose Edit - Transform to launch the Transform dialog.    The dialog launches with the Geom field in the US states drawing as the target field.

 

eg_overlay_contained01_04.png

 

We click the Overlay Contained template to highlight it.   Since there is only one other drawing in the map the US cities drawing will automatically be loaded into the Overlay box.   We click the Options button to specify which fields we would like to transfer and what transfer method should be used to transfer field values.

 

 

eg_overlay_contained01_05.png

 

In the Transform Options dialog we change the transfer options for the Population field to sum and we set the transfer options for all of the other fields from the overlay drawing to ignore so they will not be transferred.   To keep the display from being cluttered an ignore choice is shown as a blank in the transfer column for fields that are to be ignored.    

 

We will leave as is the default suggestions for the names of the new components. We press OK.

 

eg_overlay_contained01_06.png

 

Press the Add Component button to create a new component using the Overlay Contained template.

 

eg_overlay_contained01_07.png

If we open the resulting new drawing we can see that it looks exactly like the US states drawing.   That makes sense because it was created by transferring into the new drawing a copy of the geom field values of the US states drawing.

 

eg_overlay_contained01_08.png

 

If we open the resulting new table we see that each record now has a new population field, prefixed with an o_ indicating it is the result of an overlay to give the name o_Population.   That new field gives the sum of all of the Population fields for each contained city point in the overlay drawing.   By summing the populations of all of the city points in each state we get a total population for each state.

Notes

1998 Data  - Residents of cities illustrated might notice the populations of their cities are slightly off the current population.  The data in this example were taken from US Census and National Atlas downloads that give populations as of 1998.

 

Approximations - Summing the populations of the largest cities in a state will result in a total population for the state that is lower than the true total, because people who live in small towns will not be counted.  That is OK for the purposes of this example, which is to show how to use Overlay Contained and not to provide an accurate population count for each state.

 

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 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: Overlay Topology Intersect - In this example we use the Overlay Topology, Intersect template in the Transform dialog to trim a drawing of points so that all points which do not fall within areas in a second drawing are deleted.   The drawing of points we trim will become the US cities drawing that is used in the Example: Overlay Contained topic.

 

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.

 

Example: Union Areas - Combine multiple area objects into a single area.   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.

 

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.