Example: Combining Selections using the Select Dialog

In this example we use selections to solve a one-off problem casually that would be more difficult to solve rigorously with SQL.   The objective in the example's scenario is to visit a point of tourist interest while travelling.    We will use mouse selection as well as the Select dialog.

 

In this example we have a database of archaeological sites in France ranging from Neolithic times onward, with information on each site and its location, as seen in the table below.

 

eg_dolmenselection01_02.png

 

The table includes a field indicating the rank of the site that combines factors such as importance, state of preservation and so on.  Higher ranked sites would be a greater priority to visit in the field for a tourist or researcher.

 

eg_dolmenselection01_01.png

 

When the table's records are seen as a drawing as above, with a small view of thousands of locations, without the context of a background map we cannot tell where the various sites are located.   

 

eg_dolmenselection01_03.png

 

Seeing the drawing as a layer in a map against a background layer from a web server data source provides context.   The map above shows a zoomed in view with Chartres at the upper right and the outskirts of the city of Tours to the lower left with the thin line of a secondary road, the N10, running between them.

 

Our task in this example is to prepare for an automobile excursion from Chartres to Tours.  If there are any particularly outstanding archaeological sites very close to our route we would like to stop and to visit them.  In particular, we would like to visit any outstanding dolmens along the way.   A dolmen is a relic from Stone Age times, in particular the Neolithic, with most having been erected approximately five to six thousand years ago.   Because of time constraints on our journey we can only consider sites very close to our route.

 

The classic spatial SQL approach to this task would be to obtain a drawing that shows the road network as line objects and to then use spatial SQL to find those records that are dolmens with a high rank which are within some maximum distance of the road line that represents the N10.   However, it can take time to locate a suitable road network and then to pull out only that part of the N10 over which we will travel.

 

Selections allow a simpler approach based on interactive use.   

 

eg_dolmenselection01_04.png

 

We begin by considering the region near the road we will use, seen above in emphasized color in the illustration.  There are still many dots in that region, some of which may represent dolmens and perhaps some of which are even dolmens with a high rank.

 

eg_dolmenselection01_05.png

 

Using mouse-based selection we draw selection boxes to select in the drawing only those dots (seen in red selection color) which are right next to the road we will use.  We do not know which, if any, of those dots are dolmens or if any have high interest, but these are the sites we feel are close enough to our route to visit if they are the locations of  interesting dolmens.

 

eg_dolmenselection01_06.png

 

If we turn off the background map we can see we have already made some progress in spatial selection by selecting a few locations in red from a mass of other locations not near our route.

 

eg_dolmenselection01_07.png

 

We next open the table in a window and then we  choose Edit - Select to launch the Select dialog.  

 

In the Template tab we choose the Text Contains template and search within the Name field for records that contain the text Dolmen.   The preview in blue color shows which records will be selected based on that criterion.    

 

eg_dolmenselection01_07a.png

We press the Replace Selection command button at the bottom of the dialog to select those records.  The records appear in purple color purple color, a blend of red selection and blue preview colors since they have been selected but the preview is still active.

 

 

eg_dolmenselection01_08.png

 

Next we choose the Greater or Equal template to find those records with a value of 8 or greater in the Rank field.  The table seen behind the dialog uses four colors to show both the results of the prior selection operation together with a preview of what the specified Greater or Equal operation would select.

 

Records in white are not involved in the prior selection nor would they be chosen by this template: they either are not dolmens or they do not have a rank of 8 or greater.  Records seen in red selection color are those which were selected by the prior operation as dolmens but which are not picked out by the preview as having a rank of 8 or greater.  

 

There is one record, the menhir with an mfd_id of 17, which is seen in pure blue preview color.  It is picked out by the preview for having a rank of 8 or more but it is not a dolmen and so was not selected by the prior operation. A menhir is a single vertical rock, also erected in Neolithic times.

 

The records shown in purple color, a blend of red selection and blue preview colors, are those records which were previously selected as being dolmens and which also are previewed as records that would be selected by the Greater or Equal operation as having a rank of 8 or more.  That combination is what we want.

 

eg_dolmenselection01_09.png

 

We get that combination by switching the command button to Intersect with Selection and pressing it, which intersects the Greater or Equal preview with the existing, prior selection to create a new selection in the table that is the intersection of both.  

 

eg_dolmenselection01_10.png

 

The result is a selection in the table that consists of those records which are dolmens with a rank of 8 or greater.   The illustration above shows the table just after we have pressed the Intersect with Selection button.  We haven't moved on from the Greater or Equal template so the preview is still active, casting a blue preview color on what it would select, resulting in a purple color when combined with the red color of currently selected records.  The menhir with rank 8 was not selected by the intersection so it is not selected now and is seen in blue preview color alone.

 

We now need to combine the selection that exists in the drawing, those sites on or very near our route, with the selection we've made in the table.   To do that we use the Select dialog to intersect the selection from the drawing window into the table window.

 

eg_dolmenselection01_11.png

 

Clicking on the Window tab of the Select dialog shows us other windows that are open that contain selections we can use.  All such other windows must be based on the same table we are using.  There is only one option in the Window tab, the Sites layer in our map in which we selected some points.   That Sites layer in the map is the Sites drawing that corresponds to the Sites Table we are using.   If we click on that option to highlight it, the selection in that window will be previewed in blue preview color in the table.

 

The table shows in red the current selection in the table, which consists of records that are dolmens with a rank of 8 or greater, that is, cool dolmens.  Records shown in pure blue preview color are those records for the objects selected in the drawing.  The one record seen in the table in purple color, a blend of red selected color and blue preview color,  is a record that was both previously selected for being an interesting dolmen and also is being previewed as one of the records selected in the drawing as being near the route.  That is what we are looking for.

 

eg_dolmenselection01_09.png

 

To get it we once again press the Intersect with Selection command button.

 

eg_dolmenselection01_12.png

 

This creates a selection in the table which is the intersection of what was the previous selection in the table with the selection previewed from the drawing.  As before, the illustration above shows the table just after we have the Intersect with Selection button so the preview for the selection in the drawing is still active, painting some records in blue preview color.   The one record that was selected would use a red selection color that when combined with the blue color for the preview which is still active results in a blend of blue and red for the selected record.

 

eg_dolmenselection01_13.png

 

We get a clearer view of the selection in the table by closing the Select dialog.  We can see that there is a selection in the table consisting of one record, a dolmen with rank 9 that is near our route.   To see where that is in the drawing we will transfer this selection to the drawing window.

 

eg_dolmenselection01_14.png

 

To do that we click on the map and the drawing layer in the map to move the focus there, and then we choose Edit - Select to open the Select dialog once more.  We click on the Window tab where we see there is a selection we can use from  the Sites Table.  We click on that to highlight it and then press the Replace Selection command button at the bottom of the dialog.   That will replace the selection in the drawing with the selection from the table, a selection containing the one record for an interesting dolmen that is very near our route.

 

eg_dolmenselection01_15.png

 

Seen in the drawing with the red selection dot emphasized for visibility in the illustration, we can see that we picked out the one site of interest from very many possibilities.

 

eg_dolmenselection01_16.png

 

Seen with the display zoomed in further into the drawing and background map layer turned on we can see the dolmen is located immediately by the side of a country road perhaps thirty seconds of travel from the route we will be driving.  A must see!

 

eg_dolmenselection01_17.png

 

The dolmen we have found turns out to be indeed a fine dolmen, located by the side of a road just seconds away from the traffic circle on the N10 near Saint-Hilaire-la-Gravelle.   Every day, people drive between Chartres and Tours around this traffic circle without knowing that but a few seconds away stands a fine Neolithic monument, an emissary from the Stone Age that has awed residents for thousands of years.  We too might have passed had we not utilized the power and convenience of selections to find this gem, hidden in plain sight, along our route.

 

Notes

We use dolmens as the plural for dolmen.  Some writers prefer a plural form without an s at the end.

 

This example was contributed by a hobbyist as a real-life use of Manifold.  Many people living in Europe have a hobby of visiting Neolithic and other archaeological remains that are scattered all throughout Europe.   Some make it a point when travelling to bring along maps of interesting sites to visit that are near the route of travel.

 

The database of archaeological relics used in this example is based on the same database used in the Hunting Neolithic Relics YouTube video and the  Select and Transform in a Neolithic Relics Database YouTube Video in the Manifold Sales YouTube video channel.   Watch the videos to see Manifold technology in action.  

 

Methods like those in this example can be used for many analogous tasks in business, government, military, environment, and social welfare activities.   Those analogous tasks share the common objective that from a long text list we want to pick out items that have the right characteristics in the right location, and we don't want to get buried in extra work to be able to say in a formal way what is "the right location."  We don't want to hunt for road networks in vector form and learn how to use them; we just want to pick out by eye what leaps out to us as "the right location" based on a map background that we can add in seconds.

 

This example also shows how a flexible, casual approach can be effective in spatial data work.  There are many tasks, such as the precise computation of property tax owed on a given parcel, where there is no substitute for formidably rigorous, exactly precise computations integrating complex rules.  But in other cases a less rigorous approach of using a mouse to pick items that seem "close enough" in a drawing combined with selection criteria in a table that also "seem right" can be the best way to do the job.  Especially during the creative process of making "what if" explorations, never underestimate the value of "seems right" intuition.

 

See Also

Selection

 

Select Dialog

 

Tables

 

Example: Using a Selection Box in a Table - In tables we can use the mouse to select records by drawing a selection box.  Ctrl-click and drag anywhere in the table to select all records with any part in the selection box.   Using the Alt key makes that a deselect: Alt-Ctrl click and drag anywhere in the table to deselect records with any part of the record in the deselection box.

 

Example: Mouse Selection in a Drawing Window - Using the mouse to select objects in a drawing window.   This could be a drawing layer in a map or simply in a drawing window.

 

SQL Example: Using Selection Query Functions - How to manipulate selections within a query.

 

Example: Using the Select Dialog Template Tab -  A sequence of actions using Select dialog templates.

 

Example: Using the Select Dialog Saved Tab - How to save selections and then use them later.

 

Example: Using the Select Dialog Window Tab - How to transfer selections between windows.

 

Example: Multiple Windows with Multiple Select Dialogs - Open multiple windows for the same table and open a Select dialog for each. This shows how multiple Select dialogs providing multiple selections and multiple previews for the same table can be opened and used at the same time.   

 

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.