Example: Combining Selections using the Select Pane

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 from Chartres to Tours, in France.    We will use the Transform pane as well as the Select pane.


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.



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.



When the table's records are seen as a drawing layer in a map, as above, using an imageserver layer that shows a Bing street map as a background map allows us to immediately see where the various sites are located.     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 diagonally between them from Chartres to Bonneval, Chateaudun, Cloyes-sur-le-Loir, Vendome, Chateau-Renault and then finally Tours, just out of sight beyond the lower border.  


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 archaeological 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.


A simpler approach is to create a new drawing, which we call Route, drop it into the map, and then draw a line along our route.   We then create a buffer and grab all of the Sites points within some reasonable distance, doing everything with interactive, point and click commands.   In the illustration above, we have already drawn a line in the Route drawing.  


We click on the Route layer to make it the active layer, and then we choose the Transform pane.


With the focus on the map window, in the Transform pane we choose the Route layer and then we choose the Geom field.  We double-click the Buffer template to launch it in the Transform pane.



In the Buffer template, for the Distance we enter 1500.  We leave the Unit parameter at the default Meter setting, so that for the distance we have specified 1500 meters.


In the Result destination pull down menu we choose New Table and then enter Buffer as the name of the New drawing and an analogous name for the New table. We could use whatever names we want, but it is wise to use names that remind us of what they are supposed to be.


Press Preview to see a preview of what the template will do.



The preview shows, in blue preview color, the buffer that will be created.   A blue preview caption bar appears at the top of the display with the name of the template that is being previewed.  


If desired, we can change the preview color used by Manifold in the Tools - Options dialog.   This allows us to use a color different than blue preview color in cases where a visual display already uses very much blue color or to provide a more discernible color in case of color blindness.


Previews appear above all other layers and by default are opaque.  To create the illustration above, we have right-clicked onto the preview caption bar and have chosen 50% opacity for the preview, so the route line in the layer below can be seen.


If we like what we see in the preview, we press Transform.


A new drawing called Buffer and its table appear in the Project pane.   We drag and drop the new Buffer drawing into the map.



The Buffer template create a buffer area that extends 1500 meters in all directions from the black Route line. In the illustration above we have used the Style pane to apply a yellow fill color to areas in the Buffer layer, and the Layers pane to set 50% opacity for the Buffer layer.   We have removed the Route layer from the map.


We now will create a layer with just those Sites points that fall within the buffer area.   We click on the Sites layer tab to make it the active layer.


 The Transform pane is still set to the Buffer template.   With the focus on the map window, in the Transform pane we press the up button to get back to the main level of the Transform pane, so we can pick a different template.   We choose the Sites layer and the Geom field, and then we double-click the Expression template to launch it.



In the Overlay template we choose the intersect operation.   The only other drawing in the map is the Buffer drawing, so the template automatically loads that layer as the Overlay.


For the Result we choose New Table, and then we enter Sites near route for the name of the New drawing, also entering an analogous name for the New table.  The names could be anything we want, but we will use names that indicate what the new drawing contains.


We press Preview to see what will happen, before we apply the transform.



The preview shows in blue preview color all the site points that will be picked out by the overlay.   To let the previewed points stand out more, in the illustration above we have used the Layers pane to set the opacity of the Sites layer to 20%, so that all of the site points will be faded and less visible.   Since the preview is fully opaque, the previewed points within the buffer will stand out better.  We can change the opacity of layers, and even add new layers, without losing the preview.   We can even pan and zoom within the display to take a closer look without losing the preview.


Press Transform to apply the overlay transform.


A new drawing, called Sites near route, and its table appear in the Project pane.   We drag and drop the new Sites near route drawing into the map.



The new Sites near route drawing contains all the Site points that are located within, that is, which intersect, the buffer area.   We Style the new layer to use bright blue points, and we remove the Sites layer from the map since we do not need it any more.


There are still many dots in the new Sites near route layer, some of which may represent dolmens and perhaps some of which even may be dolmens with a high rank.   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.


We have already made some progress in spatial selection by narrowing down our search to a few locations near our route from thousands of points that are listed in the Sites table.  We can make more progress by narrowing our search to only nearby dolmens that have high rank.



We next open the Sites near route Table in a window.   That is the table that lists all of the points that fell within the buffer zone.   In the illustration above, we have used the Layers pane to turn off an extra field, Overlay mfd_id, that was created by the Overlay template and which does not interest us (we could use the Schema dialog to delete that unwanted field, if we preferred).


With the focus on the Sites near route Table window, in the Select pane we choose the Name field and then we double-click the Search template to launch it.


 We choose the Select pane.



In the Search template we choose text as the Use option.    We choose contains as the Condition option.   


In the Value box we enter dolmen, as the contained text for which to search.   Since we use the default nocase collation, this will match either dolmen or Dolmen.


We leave the default none choice for the Trim parameter, meaning we will not trim any characters (including any whitespace characters) from the Name field before making the equal comparison.    


For Action, we use the default replace selection.


Press Select.    



The template selects all records that have dolmen (case not significant) in their Name field.  Selected records appear in red selection color.


If desired, we can change the selection color used by Manifold in the Tools - Options dialog.   This allows us to use a color different than red selection color in cases where a map already uses very much red color or to provide a more discernible color in case of color blindness.



The objects for each selected record also automatically appear in red selection color in the drawing layer as well.   


 The Transform pane is still set to the Search template for text fields.   With the focus on the map window, in the Transform pane we press the up button to get back to the main level of the Transform pane, so we can pick a different data type field or a different template.   



We choose the Rank numeric field, and then we double-click the Search template to launch it.



In the Search template, for Condition, we choose greater or equal (>=), and for the Value we enter 8.  We only want to find dolmens that have a rank of 8 or more.


For the Round option, we leave the default none setting, to not round the Rank values before making the greater than or equal comparison.


For the Action, instead of the default replace selection option, from the pull down menu we choose intersect with selection.  We want to intersect that resulting selection with the selection that now exists, to give us only those dolmen from the existing selection that also have a rank of 8 or greater.


Press Select.  



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 Select button.   We can see that there is a selection in the table consisting of  a dolmen with rank 9 that is near our route.  


Of course, with such a small table and only one obvious candidate in the table, we could have simply Ctrl-clicked that record to select it, instead of using the Select pane twice, once to select only dolmens and once to select dolmens with a rank of 8 or greater.   But if the table had thousands of records, using the Select pane is much faster and more accurate than to pick out desired records manually.



The drawing also shows the selected object, in this case, only one point, in red selection color.   It is slightly overlapped by a nearby, non-selected point.


We can clean up the display by getting rid of points that are not selected.



To do that we first press Ctrl-I to invert the selection, or, to do the same thing with a menu choice we can choose Edit - Select Inverse.   That inverts the selection so that all the other points in the layer are selected.   We can then press Delete or choose Edit - Delete to delete those points, leaving only the one point of interest.



We Style the layer to increase the size of the point.  Out of thousands of possible sites we can see that we picked out the one site of interest along our route.


We turn off the Buffer layer and then zoom into the map to take a closer look.



With the map zoomed in 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!



We zoom even further and add a Google satellite imageserver layer to get a photographic, overhead aerial view.  


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.    We see it below in a photograph posted by a hobbyist.  



Every day, people drive between Chartres and Tours around the traffic circle nearby 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 transforms and selections to find this gem, hidden in plain sight, along our route.


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.   See photos of more dolmens in the Example: Layout Properties  topic.   See also the Example: Create Maps topic for a look at cromlechs, also monuments from the Neolithic.


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.


A key step in this example was drawing a line along our proposed route, and then making a buffer from that line to grab all of the points that fell within the buffer.   An even more casual approach would be to use a mouse-based selection tool, like box selection, to select points along the route.   But even with selection tools such as polygonal lasso tools to select areas, that involves a significant amount of eye and mouse coordination that rapidly becomes very tedious with many points or long routes.


The approach we show in this example is much easier because without worrying about accuracy we just draw a line along our route.  It works even if the route is illustrated, as in this example, by a raster image layer.    The extra steps of using the Buffer transform and then the Overlay : intersect transform are so easy (do not make a big deal out of them... they are really easy... one step!) that it is far quicker to just sketch a line along the route of interest and use the approach in this example than it is to try to lasso with the mouse points that are near the route.     


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 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





Select Pane


Transform Pane




Example: Select a Range of Records in a Table - We can select or deselect a range of records between any two records in a table window using fast and easy mouse commands.


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 Select Pane Templates - A sequence of actions using Select pane templates.


Example: Using Select Pane Expressions - Make selections by writing snippets of SQL into the Select pane Expression template.


Example: Construct JSON String using Select and Transform - Use the Select pane and 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.