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: Every person looking at a drawing that appears to have many separate points will, logically, think they are indeed separate points.  Many GIS users have never heard of a multipoint and may be puzzled when they encounter such things.    Using a Shift-click choice in a menu is a deliberately obscure way of commanding the creation of a multipoint, so only people who really know what they are doing and are determined to create multipoints can do so.

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.

 

 

As described in the Editing Drawings topic, we choose Create Point for the mode button in the main toolbar.

 

 

We click in the drawing to add points.  The Info pane automatically opens.   We click on the Coordinates tab so we can see the coordinates of points as they are clicked.

 

To see the coordinates, we click on the Coordinates tab in the Info pane.    With each click a new previewed point appears and a row with the coordinates for that point appears in the Coordinates tab of the Info pane.

 

 

Clicking points in this way normally creates a series of individual points.    

 

To create a multipoint, we right-click anywhere in the drawing to call up the context menu, and then we Shift-click onto the Save Changes choice.   

 

We can also press Shift-Ctrl-Enter on the keyboard.    Shift-clicking the Save Changes choices, or pressing Shift-Ctrl-Enter as a keyboard short cut, are deliberately unusual commands  to make it difficult to create a multipoint by accident.

 

We exit Create Point mode by choosing the default navigation setting for the mouse cursor in the main toolbar.

 

 

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.  Alt-clicking any of the points picks all of them for the Info pane, showing them all with blue boxes of preview color, and switches to the Values tab (not illustrated).

 

We can make the blue boxes larger by clicking on the Coordinates tab to see coordinates.

 

 

The Coordinates tab of the Info pane shows that this single object has five coordinates to it, with the last coordinate marked with a branch icon.

 

Another way to see all five "separate" points are all the same object, a multipoint, is to Ctrl-click any of the points.  All of them will be selected, since they are all the same object.

 

 

If we Ctrl-click any 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.

 

Using multipoints can cause confusion, because the visual display of what seem to be multiple objects does not match the reality of a single object in the table.  Almost always using multipoints is a bad idea.  Usually a better idea is to organize data so different points are different objects and thus different records.

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.   

 

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.   To see the coordinates, click on the Coordinates tab in the Info pane.

 

 

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

 

 

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.

 

The above procedure creates a multipoint with two branches.  We can now examine it to see that it is one object with two branches.

 

We exit Create Point mode by choosing the default navigation setting for the mouse cursor in the main toolbar.

 

 

What appear to be eight points are created in the drawing.    We Alt-click on one of them.  Alt-clicking any of the points picks all of them for the Info pane, showing them all with blue boxes of preview color.  

 

We can make the blue boxes larger by clicking on the Coordinates tab to see coordinates.

 

 

All of the points are picked.  We can see in the Coordinates tab of the Info pane 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.

 

 

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.

 

 

Visually the points in the drawing appear to be separate.   One way we might notice they are all part of the same point object is if we try to select one of them by Ctrl-clicking on a point and all of the points are selected.

 

Suppose we repeat this example with a new drawing, first creating a two multipoints and then creating three more point objects.

 

 

 

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.

 

 

 

Selecting the first record in the table selects the entire multipoint.  What appears in the window to be five points is just a single multipoint object.

 

 

 

 

Selecting the second record in the table shows that the group of what appear to be eight points are a single point object.

 

 

 

 

Selecting the fourth record shows that does not appear to be a multipoint but is a point object.   It could, of course, be a multipoint with multiple "points" stacked on top of each other at exactly the same position.  We could see if that is the case by Alt-clicking it and then clicking the Coordinates tab in the Info pane to see what the coordinates are for the object.

 

The above example may be visually confusing, but at least it has the multipoint objects in separate clumps.    Imagine how confusing it would be if the drawing had multipoints mixed with points, so that if we Ctrl-clicked one of the multipoint dots what appeared to be a random set of points became selected, intermixed with other points that were not selected.  

SQL to the Rescue

When dealing with wildly crazy, mixes of points and multipoints in various locations, we can use SQL to save the day.    We use a short SQL query to find all points that have more than one coordinate in their geom:

 

 

The query text in the Command Window above is:

 

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.

Selection Pane

We can select records or objects in a table or drawing that are multipoints using the Select pane's Expression tab, into which we can cut and paste a snippet of SQL from the above examples.

 

 

For example, the above will select all points that are multipoints, using the expression:

 

GeomIsPoint([Geom]) AND

GeomCoordCount([Geom]) > 1

 

The expression tests if the geom is a point and also has more than one coordinate, that is, it is a multipoint.  If we know there are only points in the drawing, we could simply write

 

GeomCoordCount([Geom]) > 1

 

...but it is a good idea to test for areas and lines just in case the drawing includes a mix of object types.  

Notes

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.

 

Clicking on whole number coordinates - Sometimes when creating objects in drawings, or labels in a labels component, for example, when using Manifold as a CAD editor or using Manifold to create diagrams for illustrations, we would like the coordinates we click for objects to be whole numbers, such as X,Y values of -165, 40 and not -165.4954783999, 40.9398312223.   

 

The easiest, explicit way to do that is to use snap modes and set Snap to Grid to using some reasonable even number for Grid step.  in the Snap Parameters dialog.  A Grid step value of 0.1, for example, will limit mouse clicks to only those grid locations that are tenths of  the unit of measure, that is, only one number to the right of the decimal point.

See Also

Drawings

 

Coordinates

 

Info Pane

 

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 Info Pane - Step by step creation and modification of a line in a drawing using the Info pane Coordinates tab.

 

Example: Create an Area with a Hole - 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 - Create an area in a drawing where the area includes holes and also islands.