File - Create - New Drawing

Drawings provide a visual display of vector geometric data in tables in the form of geom fields, which contain the geometric data to draw points, lines or areas.   A drawing is a viewing window that displays the data from some table.   More than one drawing can display data from the same data, with each drawing using different formatting.   

 

Create a new drawing using the File - Create - New Drawing dialog, or the related form of Create - New Drawing that is available in a context menu in the Project pane.  These commands allow us to:

 

 

The New Drawing dialog that creates a drawing from an existing table, query or database view automatically can add a spatial index to a table which does not have a spatial index, provided the table is not read-only and allows altering the table schema.

 

When creating a new drawing from a table that is resident in an external DBMS that supports autogenerated identity fields, the New Drawing dialog automatically creates an autogenerated identity field within the table.  See the Schema topic for a discussion of autogenerated identity fields.

 

Although most often drawings in our projects will result from importing or linking files or data sources which automatically create drawings, we can also create new drawings if we like.   We can do that by creating a new, blank drawing and then adding points, lines and areas to that drawing.   We might do that by tracing over something visible, such as a road or building, in an imageserver layer as shown in the Example: An Imageserver Tutorial topic.  We can copy and paste objects from other drawings as well.  

 

We can also create new drawings from tables that have geometry in the table, or from queries that report a geometry field in their results table.

 

To create a new, blank drawing:

 

  1. Choose File - Create - New Drawing, or use the context menu in the Project pane.

  2. Specify a Name for the new drawing.

  3. Choose a coordinate system if the default is not desired.

  4. Press Create Drawing.

 

By default, new drawings are created using the EPSG:3857 Pseudo-Mercator coordinate system, as used by almost all modern web mapping data sources.

 

To create a new drawing based on an existing table:

 

  1. Right-click on the table in the Project pane.

  2. Choose Create - New Drawing.

  3. Choose the Geometry field to use if there is more than one in the table.

  4. Check the box to create a spatial index if one does not yet exist.

  5. Assign the correct coordinate system if the coordinate system is reported in red text.

  6. Press Create Drawing.

 

We can create a drawing from a table if the table contains a geometry field with vector geometry data in one of the Manifold geometry data types for vector geometry.  

 

To create a new drawing based on a query:

 

  1. Right-click on the query in the Project pane.

  2. Choose Create - New Drawing.

  3. Choose the Geometry field to use if there is more than one in the table.

  4. Assign the correct coordinate system if the coordinate system is reported in red text.

  5. Press Create Drawing.

  6. Drawings created from queries will appear only when used as a layer in a map that contains at least one other layer.

  7. To update the drawing after any changes in source table data, choose View - Refresh.

 

We can create a drawing from a query if the query's results table contains a geometry field with vector geometry data in one of the Manifold geometry data types for vector geometry.  The query must also report a schema if we right click on the query in the Project pane and choose Schema.  The source table for the geometry field reported in the result table should have a spatial index on that geometry field.   If the query text is changed, we must run the query at least once after changing the text, so that any future refreshes of the drawing will use the new query text.

File - Create - New Drawing

 

In the main menu choose File - Create - New Drawing or right-click an empty spot in the Project pane and choose Create - New Drawing.

 

Name

Name for the drawing.  "Drawing" by default.  Specify a more informative name as desired.

Based on

<new table> by default when launched from File - Create - New Drawing, or when right clicking on an empty location in the Project pane and choosing Create - New Drawing.  Creates a new table named by adding "Table" to whatever is the specified Name for the drawing.    The combo box is also loaded with the names of tables and queries in the project should we wish to create the drawing based on an existing table or query.

Geometry

Specify the name of the geometry field to be created within the new drawing.   "Geom" by default.

<geometry type>

An option box that appears next to the Geometry box.  Choose the desired data type of the geometry field from geom (native Manifold geometry type, the default), geommfd (Manifold geom type written in binary for storage in external databases), or geomwkb (WKB geometry type).   geomWKB is the open type that is useful for interoperability but is slower than Manifold geom.  

Create spatial index

Leave this checked.   Automatically creates a spatial index for the geometry field in the new table that will be created.

Coord system

The coordinate system to be utilized within the geometry field.   The default is the same Pseudo-Mercator coordinate system that is used by almost all web servers.  

Coordinate system picker button.  Used to specify the coordinate system to be used by the new drawing.   Choose one of the Favorite Coordinate Systems from the list that appears or choose More... to launch the Coordinate System dialog that allows choice of a seemingly infinite range of possibilities.   See the Projections Tutorial for tips on choosing a projection, and the Projections Album for illustrations of many named projections, such as the Orthographic.

Create Drawing

Create the new drawing and table.

Edit Query

Launch the Command Window loaded with a query that creates the drawing and table using the given settings.  A great way to learn how to use SQL to create drawings.

Cancel

 Exit the dialog without doing anything.

 

Create - New Drawing (From a Table)

 

Right-click a table in the Project pane and choose Create - New Drawing.

 

Name

Name for the drawing. Based on the table name by default.  Specify a different name as desired.

Based on

The table to use for the new drawing.   By default, the table that was right-clicked.     The combo box is also loaded with the names of tables and queries in the project should we wish to create the drawing based on some other existing table or query.

Geometry

Choose the geometry field to be used by  the new drawing.  Loaded by default with the first geometry field found in the table, with any other geometry fields in the table also available in the combo box.  

<geometry type>

An read-only box that appears next to the Geometry box which gives the data type of the geometry field that has been selected.

Create spatial index (or spatial index)

The name of the spatial index built on the selected Geometry field.   If no spatial index exists and the table is writable, a Create spatial index checkbox will appear.  If checked (default) will create a spatial index for the geometry field in the table.

Coord system

The coordinate system to be utilized within the geometry field.   When the coordinate system appears in red text that warns us the correct coordinate system must be assigned.

Coordinate system picker.   Used to assign the initial coordinate system if it appears in red text, or if to repair it if the coordinate system appears in black text but we know the coordinate system assigned is incorrect.   See the Assign Initial Coordinate System topic.

Create Drawing

Create the new drawing using the specified table.

Edit Query

Launch the Command Window loaded with a query that creates the drawing based on the specified table using the given settings.  A great way to learn how to use SQL to create drawings.

Cancel

 Exit the dialog without doing anything.

 

Create - New Drawing (From a Query)

 

Right-click a query in the Project pane and choose Create - New Drawing.

 

Name

Name for the drawing. 'Drawing' by default.  Specify a different name as desired.

Based on

The query to use for the new drawing.   By default, the table that was right-clicked.     The combo box is also loaded with the names of tables and queries in the project should we wish to create the drawing based on some other existing table or query.

Geometry

Choose the geometry field to be used by  the new drawing.  Loaded by default with the first geometry field found in the query's result table, with any other geometry fields in the result table also available in the combo box.  

<geometry type>

An read-only box that appears next to the Geometry box which gives the data type of the geometry field that has been selected.

Coord system

The coordinate system to be utilized within the geometry field.   When the coordinate system appears in red text that warns us the correct coordinate system must be assigned.

Coordinate system picker.   Used to assign the initial coordinate system if it appears in red text, or if to repair it if the coordinate system appears in black text but we know the coordinate system assigned is incorrect.   See the Assign Initial Coordinate System topic.

Create Drawing

Create the new drawing using the specified table.

Edit Query

Launch the Command Window loaded with a query that creates the drawing based on the specified table using the given settings.  A great way to learn how to use SQL to create drawings.

Cancel

 Exit the dialog without doing anything.

 

Drawings from Queries

To learn how to create a drawing from an SQL query, choose File - Create - New Drawing and then press the Edit Query button.

 

 

Launching File - Create - New Drawing opens the New Drawing dialog.   We press the Edit Query button to launch the SQL Command Window loaded with a query that creates the drawing and the drawing's table.

 

-- $manifold$

--

-- Auto-generated

-- New Drawing

--

CREATE TABLE [Drawing Table] (

  [mfd_id] INT64,

  [Geom] GEOM,

  INDEX [mfd_id_x] BTREE ([mfd_id]),

  INDEX [Geom_x] RTREE ([Geom]),

  PROPERTY 'FieldCoordSystem.Geom' '{ "Name": "WGS 84 \\/ Pseudo-Mercator (EPSG:3857)", "System": "Pseudo Mercator", "CenterLat": 0, "CenterLon": 0, "Axes": "XY", "Base": "WGS 84 (EPSG:4326)", "MajorAxis": 6378137, "Eccentricity": 0.08181919084262149, "Unit": "Meter", "UnitScale": 1, "UnitShort": "m" }'

);

CREATE DRAWING [Drawing] (

  PROPERTY 'Table' PragmaValue('creatednamequoted'),

  PROPERTY 'FieldGeom' 'Geom'

);

 

The query above is very simple, and shows how to create a map using SQL.

 

Notes

Automatic computation of extents - Centering or zooming a map layer built on a query automatically computes the extents of the layer and remembers them for future use in zoom commands, until the layer is refreshed or the window is closed.

 

No geometry in the table?  - The Based on box in the New Drawing dialog is loaded with the names of table in the project, including the names of tables which do not have a geometry field.  Why is that, given that without a geometry field in the table a drawing cannot function?   This choice allows us to create a drawing component with properties stating it will use the specified table, the expectation being that we will be adding a geometry field to the table, perhaps through SQL or programmatic means, and adding the requisite FieldGeom property to the drawing which points at the geometry field that was added.

 

What about drawings based on geomWKT?  -  GeomWKT is the use of a "well known text" format to store geometry information.  Text, of course, is a very low performance way to store geometry information, but at least it has the merits of being readable without requiring much programming effort, so WKT is at times used as an interchange format.   The best way to deal with WKT is to immediately convert it into geom data type or, for interoperability at the price of reduced performance, geomwkb, the "well known binary" open format.    We can, however, also create drawings on tables that use WKT.  We do that by writing a query that converts WKT to geom in the results table, and then we create a drawing from that query.

 

Suppose we have a table called Mexico WKT Table that contains geometry in WKT text form in a field called GeomWKT.  The table shows provinces in Mexico with a Name for each.   Our query could be:  

 

SELECT [mfd_id], [Name], StringWktGeom([GeomWKT]) AS Geometry

  FROM [Mexico WKT Table];

 

There is no spatial index in the results table above, so every time we opened the drawing or refreshed it we would have to respond to the error message offering to build a temporary spatial index.   If we like we can do a one-time conversion into a new table by using SELECT ... INTO and creating a spatial index on the new Geometry field:

 

SELECT [mfd_id], [Name], StringWktGeom([GeomWKT]) AS Geometry

  INTO [Mexico Geometry Table]

  FROM [Mexico WKT Table];

ALTER TABLE [Mexico Geometry Table]

  (

  ADD INDEX Geometry_x RTREE (Geometry)

  );

 

We could create a drawing from the new Mexico Geometry Table created by the above, and it could use the spatial index created on the new Geometry field.

 

 

See Also

Maps

 

Tables

 

Drawings

 

Indexes

 

Add an Index to a Table

 

Queries

 

Projections

 

Reproject Component

 

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: Multiple Drawings from the Same Table - Illustrates how easy it is to create multiple drawings that use the same table and same geometry by copying and pasting an existing drawing.  Each new drawing takes no additional storage space in the project, but can be formatted differently.   

 

Example: Two Drawings from the Same Table - Take a table with a geom field that is visualized by a drawing.  Add a second geom field to the table and create an rtree index on that field so it can be visualized by a drawing.   Copy the first drawing, paste it and adjust the pasted copy so it uses the second geom field. Demonstrate how to use the Transform pane to show "live" modifications in the second drawing compared to the first drawing.

 

Example: Create a Drawing from a Geocoded Table - A partner example to Example: Create a Geocoded Table from a Drawing   A geocoded table has records with a latitude and longitude for each record.   This example starts with a table containing a list of cities with a latitude and longitude field for the location of each city.   We create a geom from the latitude and longitude fields using a template in the Transform pane and then we create a drawing that shows the cities as points.  This example shows all the infrastructure steps involved.

 

Example: Create a Drawing from Read-Only Geocoded CSV File - A detailed example using a mix of dialogs and SQL to create a drawing that shows data from an external, read-only geocoded CSV file that is linked into the project.