Example: Draw Lines, Areas and Points

In this example we create points, lines and areas in a drawing.   Choose File - Create - New Drawing to create a new, blank drawing.   That creates a table called Table which has two fields, an mfd_id field to use in a spatial index and a Geom field to host any geom data.   As we add objects to the drawing a new record will be added to this table for each new object where the geom contains the geometric data defining the object.

 

eg_draw_objs01_01.png

 

A drawing that visualizes the data in the table is also created, with a name of Table Drawing, which is intended to indicate it is the drawing that visualizes the content of Table but ends up sounding inelegant.    We will refer to it as "the drawing."   Open the drawing by double-clicking on Table Drawing.

 

il_default_mouse_nav.png

 

The cross cursor icon buttons in the toolbar control basic mouse mode.  The button to the left is Default mode where clicking the mouse has no effect and other mouse moves (clicking and dragging, mouse wheel, right click and drag) have the expected navigation effects.  See the User Interface Basics topic.

 

With the focus on a writable, open drawing window, either as a drawing window or with the focus on a drawing tab in a map window,  the other buttons will be enabled to allow us to add objects.

 

Creating Points in a Drawing

il_create_point.png

 

Click on the Create Point button to start adding points.  

 

eg_draw_objs01_02.png

 

Each time we Click a new previewed point appears, marked with a small, blue box icon to indicate what we see is just a preview until we commit the edits.   In this example we will create four new points.

 

 

eg_draw_objs01_03.png

When we are ready to commit the edits, that is, to actually add points to the table and thus to the drawing, we right-click anywhere in the drawing.

dlg_save_changes.png

Choose Save Changes in the pop up menu to create four separate point objects at the locations clicked.   If we like and we are in the mood to create bizarre geometries that will puzzle future users, we can shift-right-click to create a multipoint, that is a branched point object that looks like four separate points but is really only a single point objects.  

 

If we change our minds about adding the points that are previewed with blue boxes we can press the Esc key or Ctrl-backspace.

 

eg_draw_objs01_05.png

The four new points are created in the drawing.

 

eg_draw_objs01_06.png

 

What that means in reality is that four new records have been added to the table; the drawing just visualizes those records.  The geom value for each record defines the location of the point.

 

If we wanted to create additional points in the drawing we could continue to do so by clicking in the drawing so long as the Create Point button in the toolbar is active.   When creating points in a drawing, users will strike a balance between how many points they want to click before they decide to right-click to create those points.  It is not efficient to right-click after every point, but at the same time we probably wouldn't want to click hundreds of points before we right-click to commit changes.

Creating Lines in a Drawing

il_create_line.png

 

Click on the Create Line button to start adding lines.  We will create one new line in the drawing.

 

eg_draw_objs01_07.png

As we begin clicking into the drawing to create a line, each time we click a blue box appears to show the coordinate of the line that is created.   A blue line extends between the coordinate locations and to the mouse cursor to preview the shape of the line.

 

eg_draw_objs01_08.png

 

As we continue clicking the line grows.   What we see is just a preview until we commit the edits.

eg_draw_objs01_09.png

To commit the edits, that is, to create the line, we right-click anywhere in the drawing.   The blue line extending to the cursor will be ignored when we right-click.   If we change our minds about adding the line that is previewed in blue color we can press the Esc key or Ctrl-backspace.

 

eg_draw_objs01_11.png

The new line is created in the drawing.

 

eg_draw_objs01_12.png

 

As with the creation of points, what that really means is that a new record has been added to the table.  The new record contains a geom that encodes the line.  

 

If we wanted to create additional lines in the drawing we could continue to do so by clicking in the drawing so long as the Create Line button in the toolbar is active.    Note that the creation of lines is different than the creation of points in that we can create many points by clicking many times and then pressing right-click just once to create all of the previewed points at once.   In contrast, we must right-click to create each line.  

 

The difference arises from the different levels of effort required to indicate the spot where a point should go, just one click, as compared to the effort required to indicate the many spots where the coordinates of a line should go.   At times we may want to create only straight lines where two clicks are all that are required to mark the beginning and the end of the line, but usually with spatial data lines are more complex and require many more coordinates to give them the shape we want.   After clicking many times to specify the shape of a line it makes sense to then right-click to either commit the line or to abandon it.

 

Creating Areas in a Drawing

il_create_area.png

 

Click on the Create Area button to begin adding areas.    We will create one new area in the drawing.

 

eg_draw_objs01_13.png

As we begin clicking into the drawing to create an area, each time we click a blue box appears to show the coordinate for the area that is created.   A blue line extends between the coordinate locations and from the first location clicked to the mouse cursor to preview the shape of the area.

 

 

eg_draw_objs01_14.png

 

As we continue clicking the area grows.   What we see is just a preview until we commit the edits.

 

 

eg_draw_objs01_15.png

 

We click one more time to indicate the last coordinate that will define our area.

 

eg_draw_objs01_16.png

 

To commit the edits, that is, to create the area, we right-click anywhere in the drawing.   The blue line extending to the cursor will be ignored when we right-click.  If we change our minds about adding the area that is previewed in blue color we can press the Esc key or Ctrl-backspace.

eg_draw_objs01_18.png

 

The new area is created in the drawing.

 

eg_draw_objs01_19.png

 

As with the creation of lines and points, what that really means is that a new record has been added to the table.  The new record contains a geom that encodes the area.  

 

To add areas which contain "holes" or "islands" see the Example: Create an Area with Holes and Islands topic.

 

Notes

Committing or abandoning changes - When creating objects and we are ready to create those objects, we, right-click anywhere in the drawing and choose Save Changes from the pop-up menu to commit changes, or we press Ctrl-Enter or we press the Add Record button in the Coordinates tab of the Record panel.  To abandon changes, press Esc or Ctrl-backspace. or after right-clicking choose Undo Changes from the pop-up menu.

dlg_save_changes.png

 

Drawings must be writable -  To create objects in a drawing that drawing cannot be read-only.   That means:

 

 

The first requirement may seem painfully obvious, but it is easy to forget we might have added a data source in read-only mode.   Read-only data sources will have a small black lock as part of their icons.  

 

Also to consider are more sophisticated data sources, such as databases, where the individual drawings and other data within them might be subject to various access controls where different users have different permissions for different items, with some drawings or tables being read-only and others not.

 

The second requirement is easy to take for granted because Manifold will automatically create spatial indices on drawings that have been imported from various GIS formats or that we create using a New Drawing menu.  But if we have created a drawing using a query we might have forgotten to create it with a spatial index.   That is easy to fix.

 

See Also

Example: Add a Spatial Index to a Table - How to create a spatial index in a table.

 

Example: Drawings use Geom Fields in Tables  - An essential discussion on how drawings are created from geom fields in tables, including how the drawing knows which coordinate system to use.

 

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

 

Example: Create a Multipoint - How to create multipoints.

 

Example: Edit Covered Objects - Working with drawings where some areas completely cover smaller areas is a bad idea, but sometimes we have to work with data in that form whether we like it or not.   This topic shows techniques that can help us select and edit objects that are completely hidden by higher objects.