Linked Drawings from Geocoded Tables

For a general introduction to geocoded tables, see the Creating Drawings from Geocoded Tables topic.

 

Manifold can create linked drawings from geometry data in tables or from geometry data fetched or created by queries. Using geometry data in tables and then creating linked drawings from that data allows storing drawings within tables in a fully read/write and editable way. However, at times we deal with simple, non-geometry data in tables and would like a simpler way of displaying such data in drawings.

 

For example, a geocoded table contains two coordinate columns that for each record give the longitude and latitude (or X and Y) position of that record. A classic example might be a table downloaded from a GPS device that provides a list of waypoints with the longitude and latitude of each waypoint. Such a table, because it provides a location for each record in the longitude and latitude columns, is called a geocoded table.

 

For the convenience of users, Manifold provides a simple way of displaying data from geocoded tables within linked drawings. We can create a linked drawing based on a geocoded table, and when we do so Manifold will automatically create an intermediate query that takes the simple, longitude and latitude data from the table's coordinate columns and then on the fly creates geometry data from which a linked drawing is created.

 

Like all linked drawings, the linked drawing is created from geometry data; however, in this case the geometry data from which the linked drawing is created comes from the intermediate query. The automatically-created query takes data from the coordinate columns in the table and creates geometry data necessary for a linked drawing. There is nothing special about this process that could not be done manually, if we were so inclined.

 

The only magic in this process is that if we try to link a drawing from a table that contains no geometry data (Manifold can see right away if a table contains geometry data or not), then Manifold assumes we want to create a linked drawing from a geocoded table and so it launches the appropriate dialog. When we use that dialog to specify which columns are to be used as coordinate columns (that is, for the longitude and latitude columns or X and Y columns), then Manifold knows what columns to use in the query it writes for us.

 

If we had good knowledge of spatial SQL we could have written the query manually and then manually linked a drawing from that query. When Manifold does this for us automatically it saves time and requires less thought.

 

To create a linked drawing from a geocoded table:

 

1. Choose File - Link - Drawing and open the desired database file or connect to the desired data source.

2. Choose the table desired and check the desired fields. Specify the fields that contain latitude and longitude values (by default, the system will guess that any fields named "Latitude" and "Longitude" are the fields to use. Press OK.

 

Four new components will appear in the project:

 

·      A linked table - This linked table is a way of linking the table data from the geocoded table that will provide the data for the linked drawing.

·      A query - This query transforms the ordinary, geocoded data in the coordinate columns into geometry data from which the linked drawing will be created.

·      A linked drawing and the linked drawing's table - The linked drawing is like any drawing, except it is created dynamically from the data within the geocoded table.

 

For example, if the table below were located in some database provider (such as SQL Server or Oracle) or was saved in a database file such as an .mdb file it could be used to create a linked drawing.

 

X

Y

Comments

1.0

1.1

Oil Well

1

2

Oil Well

2

4

Oil Well

3

8

Oil Well

3

9

Oil Well

6

2

Gas Well

2

1

Pump

2

3

Tank

6

3

Oil Well

6

4

Oil Well

6.2

5.2

Pump

6.2

5.8

Tank

 

If we created a linked drawing from the table above using the X field for Longitude / X and the Y field for Latitude / Y we could create a drawing of points like that seen below.

 

images\sc_linked_drawing_01.gif

 

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 might change every few weeks 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

1.0

1.1

line 1

1

1

2

line 1

1

2

4

line 1

1

3

8

line 2

2

3

9

line 2

2

6

2

single point

5

2

1

line 3

6

2

3

line 3

6

6

3

line 4

5

6

4

line 4

5

6.2

5.2

line 4

5

6.2

5.8

line 4

5

 

For example, consider the table above. If the Line Number field is specified as the field to use for LineID then Manifold will use the first three records to draw a line through three coordinate points because the value of 1 is the same in the given LineID field. Next, the system will draw a line through two points corresponding to the records with LineID values of 2. The next record has a LineID value of 5 but because the LineID value changes immediately to the next record it is ignored.

 

The system then encounters two records with LineID of 6 so it creates a third line through two points. Finally, Manifold reads four records with a Line ID of 5 so it creates a fourth line through four coordinate points.

 

From the above example note there are two key characteristics of this simple format for representing lines in tables:

 

·      Lines are created from records taken in order. The geocoded table must list the coordinate records in the order that the line is to be built, from beginning to end.

·      Lines are denoted by a change of value in the LineID field and are not tied to unique values. In the example above the 5 value was used twice in the table. Once it was used for a single record and thus ignored and the second time it was used for a line consisting of a sequence of four points.

 

To amplify the second point, the table below would have the same effect in creating lines as the table above.

 

X

Y

Comments

Line Number

1.0

1.1

line 1

1

1

2

line 1

1

2

4

line 1

1

3

8

line 2

0

3

9

line 2

0

6

2

single point

1

2

1

line 3

0

2

3

line 3

0

6

3

line 4

1

6

4

line 4

1

6.2

5.2

line 4

1

6.2

5.8

line 4

1

 

A new line would be created whenever the field used as the LineID field changed from a 0 to a 1 or back to a 0. For legibility reasons, though, most applications will use a field for LineID that more naturally identifies the lines to be created than a pattern of changing from 1's to 0's.

 

For example, if our application is a vessel tracking application that shows where ships are currently located and where they have been an easy way to show the tracks of ships where each ship has a unique ship number is to use the Ship Number as the LineID field.

 

X

Y

Comments

Ship Number

1.0

1.1

line 1

1

1

2

line 1

1

2

4

line 1

1

3

8

line 2

2

3

9

line 2

2

6

2

single point

3

2

1

line 3

4

2

3

line 3

4

6

3

line 4

5

6

4

line 4

5

6.2

5.2

line 4

5

6.2

5.8

line 4

5

 

We would set up our database so that the table used for the linked drawing is first sorted by Ship Number and then sub-sorted by a date/time field (not shown in the example above) that gives the time each location was acquired. Using the Ship Number field in that case as the LineID field will automatically result in lines that show the ship's track. If we like, we can even format the linked drawing so that lines use directional arrowhead styles so we can see the direction the ship is headed.

 

For convenience, if we import or link a drawing from a geocoded table and we build lines using a LineID column Manifold will propagate that LineID column to the created line drawing.

 

Controls

 

images\eg_link_drawing_query_02.gif

 

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 dta source that was created in the Data Source dialog (as in the example below in this topic). This dialog allows us to specify how the linked drawing should be created from the table.

 

Data source

The source used from the Data Source dialog.

Type

The type of geometry source. In the above example it is a Table with coordinate columns, that is, a geocoded table. In more advanced usage we might link a drawing from a table that contained geometry data in various forms, such as with a spatial DBMS or a table containing geom types.

Source

The table to use, if there is more than one table in the data source.

images\btn_show_all_columns.gif

Select All - Check all columns.

images\btn_hide_all_columns.gif

Select None - Do not check any columns.

images\btn_show_inverse.gif

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

Choose a field to use for X coordinate or longitude.

Y

Choose a field to use for Y coordinate or latitude.

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.

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.

Coordinate order

Only enabled if a Line ID field is selected. Specify a field to use to determine the order in which records are taken to construct a line.

 

Coordinate Order

 

When building lines using some LineID column, Manifold by default will take records as they come in whatever order they are presented by the data source for the table. That is risky, because the order in which records are presented might be varied by sorting, compaction or other activities with tables and databases.

 

Specifying some field that gives the order in which records are taken for lines will guarantee the line is assembled in correct order.

 

X

Y

Comments

Ship Number

Line Order

1.0

1.1

line 1

1

1

1

2

line 1

1

2

2

4

line 1

1

3

3

8

line 2

2

1

3

9

line 2

2

2

6

2

single point

3

1

2

1

line 3

4

1

2

3

line 3

4

2

6

3

line 4

5

1

6

4

line 4

5

2

6.2

5.2

line 4

5

3

6.2

5.8

line 4

5

4

 

For example, the sample table used above could have a Line Order column added to it that has numbers in ascending order for each of the coordinates of a line. Even if the table is resorted into random order the lines will still be assembled correctly if the Line Order field is specified in the Coordinate order box.

 

Refresh Data

 

The data in an external table from which a linked drawing is created controls the contents of a linked drawing. When a record is added to or deleted from the table a corresponding point in the linked drawing will be added or deleted. If the coordinates of a record are changed in the table the corresponding point in the linked drawing will move.

 

When Manifold is used interactively, linked drawings are updated whenever they are opened or whenever we press the View - Refresh Data command. When Manifold is used in Internet Map Server mode, linked drawings will automatically be refreshed on whatever interval has been specified.

 

Refreshing a linked drawing will fail gracefully in case of a connection error, for example, as might be caused by a network failure if the drawing is linked from a data source accessed over a network. In general, whenever an update fails for a component linked from an external table Manifold will report any detailed error data returned by the data source.

 

Note that unlike map server mode, in interactive usage linked drawings are not automatically refreshed. They are only refreshed (updated to any changes in the controlling table) when the drawing is opened or when the Refresh Data command is issued. The reason for this behavior is to guard against situations where the linked drawing suddenly changes while we are in the middle of an editing command or a transform operation.

 

Because external tables can be edited independently of what we are doing in Manifold, if linked drawings were automatically refreshed in interactive mode we could easily encounter a situation where were doing something and suddenly points might appear or disappear or move about. Suppose we were in the middle of transferring a selection from the linked drawing to an image: in that case the sudden change would wipe out the operation.

 

Relinking a Drawing Linked from a Geocoded Table

 

Drawings linked from coordinate columns in geocoded tables cannot be relinked if a connection is lost using the Relink command: attempting to relink such a drawing using the Relink command can only reconnect the drawing to the intermediate query. If the connection to an external data source is lost, the linked table within the project upon which the intermediate query operates is the component that must be relinked. In such cases it is usually easier to simply re-create the linked drawing directly from the external data source using the File - Link - Drawing command.

 

Cascading Links and Refresh Data

 

Manifold allows cascading links, where one linked component is created from another linked component. Circular links are resolved automatically. For example, suppose we create a linked table called Table A in a project that is linked from a geocoded table called Table X in an external data source, such as a table in a SQL Server or Oracle database. We could then create a linked drawing in the project that is linked from that linked table. Let's say we call that linked drawing Drawing A.

 

However, when a cascading link is created in this way, refreshing the linked drawing will update the drawing to any changes made in the linked table, but it will not cause a cascading refresh backwards out of Manifold to the external database. That is, if we make any changes in Table A and we then refresh Drawing A, the drawing will show those changes. However, if we make any changes in the external Table X and then we refresh Drawing A, the changes will not appear in the drawing. We must first refresh Table A so that it incorporates the latest changes in the external Table X and then we can refresh Drawing A.

 

Properties

 

We can get useful information on a linked drawing by right clicking on it in the project pane and choosing Properties to see the View - Properties dialog. Clicking the [...] browse button to the right of the Status information line opens a very useful dialog that shows the data source of a linked component, the link technology and the name of the rowset, if the component is linked from a table or query and the behavior of the data in multi-user editing scenarios.

 

Caching

 

Linked drawings are automatically cached locally using techniques similar to those employed in Manifold Enterprise Edition to cache shared components that are linked from an Enterprise server. If a connection to an external database table is lost during a work session Manifold will continue to operate the linked drawing using the local cache. When a project containing a linked drawing is saved, the local cache will be saved into that project .map file. When the project is opened again, the cached image will be synchronized with the current version of the database table so when the drawing is opened it will show the latest data in the table.

 

Use with IMS

 

Linked drawings work very well with IMS (Internet Map Server) applications. There are three main considerations to keep in mind when using linked drawings within a map server project:

 

·      Choose a suitable refresh interval. The Refresh linked components every … minutes control in the Export Web Page dialog allows choice of refresh interval. Choosing a value of 0 will force a refresh with every browser session served. With a large number of users, this is a guaranteed way of achieving unacceptably poor performance. A better idea is to choose a low value such as one or two minutes, if a linked drawing must be kept reasonably up to date as, for example, in vehicle tracking applications.

·      The Internet user login (IUSR_systemname) for the machine running IMS must have access permissions to read the database table used to control the linked drawing. When Manifold runs in IMS mode it runs with the Internet user's permission and so must have the ability to at least read the table.

·      The path to the table must be preserved, or IMS will not be able to find the data source and open the table.

 

Absolute Paths

 

When specifying a database table to control a linked drawing the path to the data source is often normalized by Microsoft OLE DB or ODBC drivers to an absolute path. Therefore, when moving projects and any tables used by linked drawings to a different machine, try to preserve the absolute path to the table. For example, if the table is located at C:\Manifold Projects\mytable.mdb on one machine then place it in the same location on the other machine. This is obviously an important consideration when moving files from a development machine to a production IIS machine for use with Manifold IMS in a map server application.

 

If we would like to exchange data with other users we should employ linked drawings with care if the linked drawing is created from a table or query outside the Manifold project. If the table controlling a linked drawing is outside of Manifold it will not stored within the Manifold .map project file. Sending a colleague a copy of our .map file will not also send them the database table from which the linked drawing is created.

 

Re-attaching a Linked Drawing to a Data Source

 

If a linked drawing is disconnected from its data source, it may be reconnected using the Relink command. See the Drawing - Relink / Unlink topic.

 

Linked drawings are deliberately designed to have a very damage-resistant connection to their originating tables. We can even delete the table and the drawing will still function from cache if at all possible, ready to be relinked. Renaming or removing the table or query (or renaming or removing the coordinate columns in the table or query) harms the link between the drawing and the table, but linked drawings are designed to survive such scenarios and can even be relinked to modified data with the Relink command.

 

While it is not a good idea to tempt fate by deleting tables or otherwise removing data upon which linked drawings depend the robust nature of the connection combined with use of the Relink command will often allow linked drawings to survive significant damage.

 

Converting a Linked Drawing to an Ordinary Drawing

 

Convert a linked drawing to an ordinary drawing by right clicking on the linked drawing in the project pane and choose Unlink. This will cut links to the controlling table or query and recreate the drawing as an independent, ordinary drawing. See the Drawing - Relink / Unlink topic.

 

Importing an Ordinary Drawing from a Geocoded Table

 

Drawings may also be created from geocoded tables by using File - Import - Drawing and selecting a database table file or data source in the Files of type box. In this case a drawing of points will be created from the geocoded table but it will not be linked to the table.

 

Editing Linked Drawings

 

Although a linked drawing that appears in the project pane is normally read-only, it is usually possible to edit that linked drawing by editing the linked table within the project from which it is created, which will end up editing the table in the data source as well. We could also edit the original data source. For example, suppose we have a linked drawing created from a query that grabs data from a table in an external database file. We could change that linked drawing by editing either the external table or by editing the query.

 

Linked drawings normally are used not for the purpose of interactive editing through the Manifold console graphical user interface but rather to display visually data from some database table. The assumption is that the database table from which the drawing is created will be edited through the database management system or by other programs which will change the data in the table.

 

Open Data Source Command

 

Right clicking a component that is linked from an external data source in the Project pane and then choosing Open Data Source will open the Database Console and connect to the component data source.

 

Opening a component linked from an external data source in its own window, and then choosing the Open Data Source command in the component menu (for example, choosing Drawing - Open Data Source when a linked drawing window is open) does the same thing.

 

Creating a "Lines-only" Display

 

When creating lines in a linked drawing using the LineID option Manifold will draw all points as well as lines in the drawing.

 

images\sc_linked_drawing_lineid_01.gif

 

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.

 

images\sc_linked_drawing_lineid_02.gif

 

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.

 

images\sc_linked_drawing_lineid_03.gif

 

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.

 

images\sc_linked_drawing_lineid_04.gif

 

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.

 

images\eg_link_drawing_query_01.gif

 

The table seen above in Microsoft Access 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 resulting Data Source dialog we must add a new data source for the Access .mdb file in which the table is stored.

 

images\eg_link_drawing_query_02c.gif

 

Click on the Add Data Source button.

 

images\eg_link_drawing_query_02b.gif

 

In the resulting Connect To dialog we navigate to the folder in which the .mdb file is stored and choose MDB Files in the Files of type box. We can then click on the desired .mdb file to highlight it and then press Open (or, simply double-click on the desired .mdb file).

 

images\eg_link_drawing_query_02a.gif

 

This adds the file as a data source. We enter a memorable name into the Name field for the data source, in this case, Sushi Restaurants and press OK.

 

images\eg_link_drawing_query_02.gif

 

In the resulting Link Drawing dialog we can accept defaults, since the table already has fields named Latitude and Longitude and Manifold will know to use them by default as the Y and X fields. Press OK.

 

images\eg_link_drawing_query_03.gif

 

The result is that several new components appear in our drawing, including a new linked table, an intermediate query and a new linked drawing and its table.

 

images\eg_link_drawing_query_04.gif

 

If we open the linked table we see it is simply a table linked to the external Access .mdb table. If we change anything in that external table the changes will appear in this linked table and vice versa.

 

images\eg_link_drawing_query_05.gif

 

If we open the drawing we see that it contains a point at the location of each restaurant. This drawing has been created from the table via an intermediate query that creates, on the fly, geometry data from the geocoded table.

 

There are many things we can do with geometry data. However, even though our new linked table (seen above) has been created automatically by Manifold to make it more convenient for us to create linked drawings from external geocoded tables, it is still a Manifold table just like any other. We can use it just as we might any other table.

 

In fact, we can create queries from that table in addition to the intermediate query already automatically created for us by Manifold. If we would like to customize the data taken from that table we can easily do so with a query.

 

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.

 

images\eg_link_drawing_query_06.gif

 

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.

 

images\eg_link_drawing_query_07.gif

 

If we are curious to get a tabular view of the query's results, we can highlight the query in the project pane and press the Run button to see the above. Note that records from Menlo Park have been selected.

 

Manifold allows us to use the results of queries like tables. If we like, since the above results provide geocoded table data, we can create a linked drawing from them. In this case, instead of linking a drawing to an external geocoded table we will link it to a query within the same project.

 

images\eg_link_drawing_query_08a.gif

 

We once more we launch the File - Link - Drawing dialog and choose This Project in the Data Source dialog. This data source is "built into" the Data Source dialog when linking a drawing. It allows us to create linked drawings from the Manifold project with which we are working.

 

images\eg_link_drawing_query_08.gif

 

In the Source box in the Link Drawing dialog we choose Menlo Park Restaurants, the name we used for our query. We accept all other defaults and press OK.

 

images\eg_link_drawing_query_09.gif

 

Several additional components are created in the project pane: a new linked table called Menlo Park Restaurants 2 that is linked from the query, an intermediate query, and a linked drawing and its table.

 

It may seem to be somewhat extravagant of Manifold to create these new components, but doing so provides a very systematic, regular approach to the matter that is the same whether we link a drawing from a geocoded table from outside the project or from inside the project: in both cases, the first thing Manifold does is create a linked table to the data, and then an intermediate query and finally the linked drawing and its table.

 

images\eg_link_drawing_query_10.gif

 

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 linked Sushi Restaurants table and the drawing linked from the Menlo Park Restaurants query. This will show how Manifold can have cascading links within the same project, where one linked component is created from another linked component.

 

images\eg_link_drawing_query_11.gif

 

Let's select two of the sushi restaurants in the original table and delete them.

 

images\eg_link_drawing_query_12.gif

 

Selecting the two records and pressing Edit - Delete will delete the records for Mikasa and Toshi's Sushiya.

 

images\eg_link_drawing_query_13.gif

 

If we click on the Menlo Park Restaurants 2 Points 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.

 

images\eg_link_drawing_query_14.gif

 

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.

 

images\eg_link_drawing_query_15.gif

 

If we click onto the Menlo Park Restaurants 2 Points 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.

 

Note that when linked drawings are created using cascading links that ultimately arise from data sources outside of the Manifold project, a refresh of the drawing will cause a refresh all the way back to the original, external data source, to update the drawing using the latest data available.

 

Read / Write Linkage to Databases

 

Keep in mind that when Manifold links a table from a database that unless something about the connection makes it read-only (not a typical situation), the connection will be read / write. Changes we make in the linked table are changes in the database from which it is linked.

 

images\eg_link_drawing_query_16.gif

 

Consider the Sushi Restaurants linked table as it is at the end of the above example.

 

images\eg_link_drawing_query_17.gif

 

If we opened the originating .mdb file in Access we could see the same table in Access, as seen above. [We can have the same table open both in Access and also have Manifold running with the linked table opened in Manifold as well.]

 

images\eg_link_drawing_query_18.gif

 

Suppose that back in Manifold we highlight two of the records...

 

images\eg_link_drawing_query_19.gif

 

...and delete them.

 

images\eg_link_drawing_query_20.gif

 

In Access, we would see that both records were deleted from the table as well. Note that depending on how we are viewing tables in Access we don't have quite as convenient facilities as we do in Manifold to refresh tables that might be updated. We may have to close a table and then open it again to see it refreshed.

 

Suppose that back in Manifold we issue an Undo command to restore the two deleted records to the table. Not only will they re-appear in the linked table in Manifold...

 

images\eg_link_drawing_query_21.gif

 

...but will also appear back in the table in Access as well.

 

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:

 

For example, we might 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.

 

Important Note when Using 64-bit Manifold Editions

 

Due to a lack of required Microsoft facilities in 64-bit Windows systems, Manifold in 64-bit mode cannot export, import, export or link to DB, HTML, MDB, XLS or WKx format files. This includes no access to the MDB parts of Manifold MFD and MapInfo TAB imports. The workaround for importing or exporting such files is to launch Manifold in 32-bit mode by using the Manifold System 7x (32-bit) shortcut, perform the export from or import into a .map project file and then re-launch Manifold in 64-bit mode using the Manifold System 7x (64-bit) shortcut. Linking is more complex: the data must be in some format usable in 64-bit mode within 64-bit Windows systems, such as a SQL Server database. Alternatively, the data can be kept within a Manifold .map project file and linked using the Manifold ODBC driver.

 

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.

 

Although this documentation is written to require decimal degrees notation, in fact if coordinate columns in a geocoded table use degree - minute - seconds notation Manifold will try to parse the notation used to extract valid longitude and latitude values. manifold.net strongly recommends using decimal notation to avoid any possible ambiguity.

 

See Also

 

Linked Drawings

Creating Drawings from Geocoded Tables

Create a Linked Drawing from a Geocoded Table

Formatting Lines in a Linked Drawing

Geometry in Tables

Importing and Linking Tables (for a discussion of ODBC and file types used for tables).

View - Refresh Data

Project Pane - Open Data Source