Example: Overlay Contained

To explore the use of Overlay templates in the Transform pane 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.


 User interfaces for the Transform pane have been changed.  See the Transform Reference topic for guides to new interfaces while this topic is updated.  Use the Join dialog for spatial overlays instead of the Transform pane.


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


Overlays in ESRI nomenclature are called spatial joins in the data science / IT world, two different terms to describe exactly the same thing.  Manifold provides overlay templates in the Transform pane so ESRI users have a familiar way to do overlays, but the point-and-click Edit - Join dialog is a more modern way to do the same jobs with easier workflow.   Overlays, for example, always create a new component while Edit - Join updates the target table or drawing in place.   Even skilled ESRI people often prefer Edit - Join.   See the Edit - Join topic for a step by step example that duplicates the example below.


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.



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.



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.



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 launch the Transform pane.   We choose the Geom field in the US states drawing as the target field.  We enter the letters over into the filter box, to reduce the very long list of templates to those which contain that text, such as the Overlay Contained template we will use.



We click the Overlay Contained template to choose it.  Since there is only one other drawing in the map the US cities drawing will automatically be loaded into the Overlay box.   



As soon as we choose the Overlay Contained template, the subject of the template, the US states layer, is shown in blue preview color, a visual display that helps us avoid errors by seeing in advance what the template will do.



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


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.  



The process is much quicker in real life than illustrated step-by-step.   We begin by Ctrl-clicking one of the transfer fields that we want to ignore.   This will select it.



We next Ctrl-click another field to select that.



We now Ctrl-click the third field we would like to select.



We double-click into a transfer method cell of any of the selected fields.



From the very long context menu of available methods we choose ignore.



Changing a transfer method for any of the selected rows changes it for all selected rows.   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 double-click into the transfer method cell for the Population field.



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



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


If we open the resulting new drawing we can see that, except for using default formatting, 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.



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.



If we like, we can use the Style pane to format the fill color of areas in the new drawing based on the o_Population field, using the above settings.



The result is a thematic map display that colors the various states by their populations.   We have also used the Layers pane to specify a calm, beige color background instead of bright white.


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



Select Pane


Style Pane


Transform Pane


Topology Overlays


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: intersect template in the Transform pane 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: 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 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.