| X
| Y
| Comments
|
|
| Oil Well
|
| Oil Well
| ||
| 2
| 4
| Oil Well
|
| 8
| Oil Well
| |
| 3
| 9
| Oil Well
|
| 6
| 2
| Gas Well
|
| 2
| Pump
| |
| Tank
| ||
| 6
| 3
| Oil Well
|
| 6
| Oil Well
| |
| 6.2
|
| Pump
|
| 5.8
| Tank
|
For each record in the table, a point has been created. If we add a new
record to the table, delete a record or change an X or Y value then the corresponding point will be added to the drawing, or deleted
from the drawing or moved within the drawing.
For a step-by-step example, see the Create a Linked Drawing from a Geocoded Table example topic.
Uses for Linked Drawings
Linked drawings allow us to create drawings from data that is changeable and
most conveniently stored within geocoded tables or queries. The classic use for
a linked drawing is within a Manifold IMS application such as a vehicle tracking web site. Suppose we have a fleet of
trucks or ships or other vehicles and we would like to display the location of
each vehicle on a web site map. Suppose we can acquire the location of each
vehicle through some other application that receives location data from a GPS in
each vehicle and places it into a table in our database. Showing the location
of each vehicle in Manifold is as easy as creating a linked drawing using that
table.
Because most data acquisition software for vehicle tracking applications is
already programmed to update a database table, using linked drawings completely
eliminates the need to teach the tracking software package how to interact with
a GIS system. All the tracking software need do is update a table, as it
already knows how to do.
Linked drawings are also very useful in situations where the number of objects
to be displayed is changeable. For example, suppose we work for an insurance
company that sells its insurance products through independent agents. The list
of approved agents will change every few days as new agents are added and as
poorly performing agents are dropped. We want to create a web site that a
prospective customer can use to find the nearest agent offering our insurance
products. It would be very convenient to use a linked drawing in the web site so
that the list of approved agents can be kept in the form of a geocoded database
table.
This reduces the task of updating the list of agents to an interaction with
the database table, which allows greater flexibility in software that can be used
to update the status of each agent, what products he or she offers from our
company and so forth. There will always be many more software packages and
programmers who know how to interact with a popular DBMS product than will know how
to interact with GIS software. Therefore, using linked drawings is a good way
to add dynamic updating of data to Manifold projects and to Manifold IMS web
sites without requiring a lot of GIS expertise on the part of accessory software
or web site programmers.
Lines in Linked Drawings
Although there is no standard GIS method for representing lines in geocoded
tables, Manifold uses a simple convention that can be used to create lines in
linked drawings from tables. When importing or linking a drawing from a geocoded
table, we may optionally specify a LineID column that will be used to identify which points will be used to draw lines.
As Manifold scans through the table it will draw lines through all contiguous
sequences of two or more records for which the LineID value is the same. When the LineID value changes Manifold will start a new line. If the LineID value is the same for only one record the record will be treated as a point
and no line will be drawn. The column used for LineID may be of any type, for example, it could be a numeric or a text column.
Newly-created lines will inherit the LineID values of the points used to create them.
| X
| Y
| Comments
| Line Number
|
|
| line 1
| |
| line 1
| |||
| 4
| line 1
| ||
| 3
| 8
| line 2
| |
| 9
| line 2
| 2
| |
| 6
| 2
| single point
| 5
|
| 2
| line 3
| 6
| |
| line 3
| 6
| ||
| 6
| 3
| line 4
| 5
|
| 6
| line 4
| ||
| 5.2
| line 4
| 5
|
| 6.2
| 5.8
| line 4
| 5
|
| X
| Y
| Comments
| Line Number
|
|
| line 1
| |
| line 1
| |||
| 4
| line 1
| ||
| 3
| 8
| line 2
| 0
|
| 3
| 9
| line 2
| 0
|
| 6
| single point
| ||
| line 3
| 0
| ||
| 2
| line 3
| 0
| |
| 6
| 3
| line 4
| |
| 6
| 4
| line 4
| |
| 6.2
| 5.2
| line 4
| |
| 6.2
| 5.8
| line 4
|
| X
| Y
| Comments
| Ship Number
|
|
| line 1
| |
| line 1
| |||
| 4
| line 1
| ||
| 3
| 8
| line 2
| |
| 9
| line 2
| 2
| |
| 6
| 2
| single point
| 3
|
| 2
| line 3
| 4
| |
| line 3
| |||
| 6
| 3
| line 4
| |
| 4
| line 4
| 5
| |
| 6.2
| 5.2
| line 4
| 5
|
| 6.2
| 5.8
| line 4
| 5
|
When creating a linked drawing the typical dialog seen when connecting to a
database file or data source is seen above. The illustration shows a connection
to an Access .mdb file but a very wide range of data sources (ODBC, ODBC.NET, OLE DB, etc.) may
be used. This dialog allows us to specify how the linked drawing should be
created from the table.
| Table / query
| Choose the table or query to be used as a source. Queries cannot be parameter
queries.
|
| Select All - Check all columns.
| |
| Select None - Do not check any columns.
| |
| Select Inverse - Uncheck all currently checked columns and check all other columns. A fast
way to use all but one column: click Select None, check the one column not desired and then click Select Inverse.
| |
| Columns pane
| Check columns that are to appear for each point in the linked drawing.
|
| X / longitude
| Choose a field to use for X coordinate or longitude.
|
| Y / latitude
| Choose a field to use for Y coordinate or latitude.
|
| LineID
| Optionally specify a field to use to determine points that are to be used to
guide the creation of lines. A line will be drawn through all points having the
same value in the LineID field. A new line will be started for each new value in the LineID field. Single-point lines are ignored. The LineID column may be of any type.
|
| Latitude / longitude coordinates
| If checked, interpret the X / longitude and Y / latitude coordinates as
unprojected latitudes and longitudes using decimal degrees. Checked by default.
Uncheck if the table coordinates contain projected coordinates.
|
This can result in a cluttered display, like that seen above created from the
tables used as examples earlier in this topic. The lines have been formatted
using a directional line style to show their beginnings and ends. Since points
are also drawn they appear above the lines in the same drawing and depending on
placement can clutter the drawing.
In interactive work we can easily remove the points, if desired. When working
with IMS we cannot interactively delete the points, but we can use a
convenient formatting trick to prevent them from appearing. We simply format the
drawing so that points are drawn using transparent color for the foreground color.
This causes the entire point to disappear so no points appear in the drawing,
resulting in a lines-only drawing. If we need to create an IMS display that
has a combination of some lines and some points we can create two linked drawings
in our project from the same table, one of which uses the LineID option and has foreground formatting for points set to transparent color so
there are no points and the second drawing of which does not use the LineID option so there are no lines. By using the two drawings in a map with the
lines-only drawing appearing in a layer above the other drawing we can cause
points to appear below the lines.
The appearance in IMS will be the same except that the points will appear to
be drawn below the lines.
There are many possibilities to create exactly the display desired. For
example, if a display is desired that shows lines for all points but which draws
points only for single points or only for the last point in a line sequence we can
use SQL to help create such a display. We begin by creating a lines-only
display in one linked drawing. Next, assuming that points have fields that can be
used to distinguish one point from another we can use a SQL query in our
database to create a table that has only single points or terminal points (through
clever use of fields that distinguish one point from another) and then create a
linked drawing from the query.
Combining the two drawings in a map will result in a display that shows lines
for all points but draws only those points that are single points or that are
terminal points. The exact SQL expression that creates a table of only single
points or terminal points will, of course, be dependent on what fields are
available and how the geocoded table is written in the first place. For example, if
we have a vehicle tracking application the code that updates the table with
the latest position point may write a flag field that marks this record as the
latest in the sequence for that vehicle.
Example
In this example we take a geocoded table of restaurant locations and we create
a linked drawing. We then create a query using the table and create a linked
drawing from that query.
The table shows sushi restaurants in Palo Alto and Menlo Park near the
Northern California USGS facility in Menlo Park. The table is similar to the geocoded
table created in the Street Address Geocoding topic example.
To create a linked drawing using this table we choose File - Link - Drawing and then in the Files of type box in the Link dialog we choose This Project ().
In the resulting Link Data dialog we choose Sushi Restaurants as the table to use. The table already has fields named Latitude and Longitude so we can accept the defaults and press OK.
The result is that a new linked drawing appears in our project.
If we open the drawing we see that it contains a point at the location of each
restaurant.
Suppose that we would like to create a linked drawing that shows only sushi
restaurants in Menlo Park. We can do that by writing a query and then creating a
linked drawing from that query.
We create a query with the text above. If all we are interested in are the
locations of the sushi restaurants we don't need to select everything (using Select *) but we must select at least the Latitude and Longitude fields. In this case, we select everything so that the linked drawing's
table will have all the fields that were in the original table.
Once more we launch the File - Link - Drawing dialog and choose This Project () in the Files of type box in the Link dialog. In the Table / query box in the Link Data dialog we choose Query.
One more linked drawing is created in the project pane.
When we open the new linked drawing and pan and zoom it to the same location
as the other linked drawing, we can see that it shows only those restaurants
that are in Menlo Park (which is slightly North and West of Palo Alto).
Now let's do something interesting and show the nature of the linkage between
the original table and the drawing linked to the query. Let's select two of
the sushi restaurants in the original table and delete them.
Selecting the two records and pressing Edit - Delete will delete the records for Mikasa and Toshi's Sushiya.
If we click on the Data 2 drawing (the linked drawing created from the query) and choose Edit - Refresh Data the linked drawing will refresh back through the query and cause the query to
refresh itself from the (now altered) table. The result is that two points,
those representing Mikasa and Toshi's restaurants, disappear.
We can bring the records back by clicking onto the original Sushi Restaurants table and choosing Edit - Undo. This restores the records, which has the same effect as if we added two new
records.
If we click onto the Data 2 drawing and choose Edit - Refresh Data once more we see two new points appear for the restored records. If only it
was that easy to bring a good sushi restaurant back into business!
The point of the example above is to show how linked drawings are created on
the fly from geocoded tables or queries that contain geocoded data. As records
are edited, added to or deleted from the original tables or queries, points
corresponding to those records will move, appear and disappear as the drawings
linked to those tables or queries are refreshed.
Example Scenario
Linked drawings created from tables or queries have great flexibility. In
addition to the above example, consider this scenario in which a linked drawing is
used to create a particular display:
Scenario - We have a table of populated places linked from an SQL Server database. We
want to label the places so that labels for larger places appear on top of
labels for smaller places.
We create a query for each population range such as…
SELECT [Latitude (I)], [Longitude (I)], [Pop] FROM [Places] WHERE [Pop]
BETWEEN 10000 AND 50000;
… and we link a drawing from each query.
We then create a label component for each linked drawing and place all the
label components in a map so that the label layers for larger places are higher on
the display stack than those for smaller places. Each time the project is
opened, the system will connect to the table on the SQL Server, re-compute the
queries, update the drawings linked to the queries and update the labels bound to
the drawings.
Dynamic Drawings
An even more powerful form of linked drawings is the use of dynamic drawings created from tables that store geometry data. See the Dynamic Drawings and Geometry in Tables topics for additional information.
Tech Tip
Master the use of linked drawings with geocoded tables that use
straightforward, unprojected longitude and latitude coordinates before attempting to work
with geocoded tables that use projected coordinate systems for their X and Y coordinates.
Notes
Refreshing a linked drawing created from a table that resides in an external
data source will refresh the table. Refreshing a drawing linked from a query
will recompute the query.
Refreshing a query will refresh all linked drawings descended from that query.
See Also
Linked Drawings and Geocoded Tables
Create a Linked Drawing from a Geocoded Table
Formatting Lines in a Linked Drawing
Importing and Linking Tables (for a discussion of ODBC and file types used for tables).
View - Refresh Data
Dynamic Drawings