Example: Create a Multipoint

This topic provides two examples:  First we create a multipoint and then next we compound the insanity by creating a multipoint having two branches.  


The purpose of this topic is to help teach the implementation of geometry in Manifold and other typical spatial packages using a somewhat unusual, highly counter-intuitive and (mercifully) rarely-met object type, the multipoint.  A multipoint combines what appear to be many separate points into a single multipoint object.  


For most people and for most applications it is a really bad idea to use multipoints since every person when looking at a drawing that appears to have many separate points will, logically, think they are indeed separate points.  Most GIS users have never heard of a multipoint and are baffled when they encounter such things.  

Example: Create a Multipoint

This example shows how to create multipoints, which generally are a type of object that should not be used outside of very rare situations.   Because we might encounter such objects in imported data we should understand that they exist and how to work with them, hence this example.


In the Project pane we create a new drawing which by default is called Drawing and uses a new, empty table called Drawing Table.   We open the drawing.




In the main toolbar we choose Create Point.




We click in the drawing to add points.  The Record panel in the Contents pane automatically opens.    With each click a new previewed point appears and a row with the coordinates for that point appears in the Coordinates tab of the Record panel.




To add a multipoint we right-click anywhere in the drawing to call up the context menu, and then to create the multipoint we Shift-click onto the Save Changes choice.   We can also press Shift-Ctrl-Enter on the keyboard.




What appear to be multiple points appear in the drawing.   To see that these are all just one point object that is a multipoint, we can Alt-click on any of the "separate" points to choose it as the subject for the Record panel.





The Coordinates tab of the Record panel show that this one object has five coordinates to it.

eg_create_multipoint01_04.png  eg_create_multipoint01_05.png

If we Ctrl-click and drag a selection box around one of the points we select all of them.  That is additional proof that what appear to be separate point objects are all just a single multipoint object.




When we open the drawing's table we see that there is only a single record for a single point object.   The geom for that point object is a multipoint that consists of the coordinates we clicked.


It is obvious that using multipoints can cause confusion, because the visual display of what seem to be multiple objects does not as we expect match the table presentation of a single object in the table.  Almost always using multipoints is a bad idea instead of structuring data so that different points are indeed different records and thus different objects.

Create a Multipoint with Two Branches

We will continue the theme of illustrating nuances of geometry by creating a point object which we should never in real life need to create, a multipoint that has two branches.   This example shows a legal, but totally strange choice that we might encounter when importing data.   


As before we create a blank drawing, choose the Create Point tool and begin clicking into the drawing to create coordinates for points




After clicking three times to create coordinates we Shift-click to create a coordinate that is also the end of a branch.  




We click a few more times to create more coordinates.   The preceding last coordinate in the branch is marked with an inverted T symbol, indicating the end of a branch.




To create the previewed multipoint, we right-click anywhere in the drawing and then Shift-click on the Save Changes choice in the context menu.




What appear to be eight points are created in the drawing.    





Visually, they appear to be eight separate point objects but if we open the drawing's table we can see they are only a single object.





If we Alt-click on one of them we can see in the Coordinates tab of the Record panel they are all the same point object, a point object that is a multipoint with two branches.  The ends of both branches are marked with an inverted T symbol, indicating the end of a branch.



eg_create_multipoint02_06.png  eg_create_multipoint02_07.png

Visually the points in the drawing appear to be separate.   As a practical matter the way we would notice they are all part of the same point object is if we try to select one of them using a selection box and it is not selected.   If we use Shift-click and drag to draw a selection box that will select an object if any part of it falls within the box, then we would select all of the points involved in the multipoint.


Suppose we repeat this example with a new drawing, first creating a multipoint and then creating another multipoint with two branches:


eg_create_multipoint02_09.png  eg_create_multipoint02_10.png


How can we see which are multipoints and which are not?   One way is to select records in the table to see which corresponding objects in the drawing also are selected.


eg_create_multipoint02_11.png  eg_create_multipoint02_12.png



eg_create_multipoint02_13.png  eg_create_multipoint02_14.png



eg_create_multipoint02_15.png  eg_create_multipoint02_16.png




We could also use SQL to find all points that have more than one coordinate in their geom:




SELECT * FROM [Drawing Table]

WHERE GeomIsPoint([Geom]) AND GeomCoordCount([Geom]) > 1;


That query will select all records for multipoints, whether or not they have multiple branches, for example, the multipoints created in this example and also in the preceding example.   We do not need to use the GeomIsPoint criterion if all we have in the drawing are points, but in case there are also areas and lines (both of which would be expected to have more than one coordinate), it is good to add that criterion to the WHERE clause as well so that only points are selected.


To find only those multipoints that have multiple branches as in this example we can use the GeomBranchCount(<geom>) function in the query:




SELECT * FROM [Drawing Table]

WHERE GeomIsPoint([Geom]) AND GeomBranchCount([Geom]) > 1;


We do not need to check for more than one coordinate in the geom since if a point has more than one branch it also has more than one coordinate.




Advice: the point of this example is not to recommend the use of multipoints but instead to teach a nuance which we may encounter when working with a data set that uses multipoints or multipoints with branches.   That such objects can exist is a side effect of the orthogonality and consistency of how geometry is defined for GIS purposes, but other than learning about such things to deal with situations where someone has chosen to use them, the risk of confusion and chaos from using multipoints is so great it is probably a better idea not to use them.


See Also





New Object Dialog


Example: Draw Lines, Areas and Points - Simple example of using basic mouse moves to add points, lines and areas to a drawing.


Example: Trace an Area in a Map over an Image Background - In a map with a drawing layer above an image layer, create an area object in the drawing by tracing over the outlines of something seen in the image layer below.


Example: Create a Line using the Record Panel - Step by step creation and modification of a line in a drawing using the Contents - Record panel's Coordinates tab.


Example: Create a Line using Curved Segments - Creating a line made up from curvilinear geometry using the New Object Dialog.


Example: Create an Area with a Hole - Using the New Object Dialog, create an area in a drawing where the area includes one or more holes.  This is similar to how we create areas that have islands as part of the area.   


Example: Create an Area with Holes and Islands - Using the New Object Dialog, create an area in a drawing where the area includes holes and also islands.