t e m p o r a l 
 d o o r w a y 

Tables, Datasets, and Layers

 

There's often confusion among new MapX users as to how MapInfo tables, ODBC (Open Database Connectivity) databases / tables, DAO (Data Access Objects ) databases / tables, MapX layers and MapX datasets all fit together. This article describes the relationship. An article on data binding describes data binding for ODBC and for unbound data, and may be useful in conjunction with this article.

MapInfo Tables

MapInfo tables are a special case in working with MapX. MapX is the only way to access these tables from your application, since there are no ODBC drivers or other ways to access MapInfo tables. MapX understands the format of the graphical objects attached to mappable MapInfo tables, and can draw them into the map. This is the best way to get complex region (i.e. state / city boundary) or line (i.e. street) maps into MapX. MapInfo tables are usually brought into MapX through the Geoset facility, and, more often than not, are predefined in MIGM20.exe (or MIGM30.exe for MapX 3 users), which defines the run time Geosets available.

MapInfo tables can be added to a MapX map at runtime - but not through data binding. Instead, use Layers.Add and supply the MapInfo table file name. Data binding is only for point layers from non-Mapinfo tables.

You cannot perform SQL queries against MapInfo tables in MapX. MapX does not support SQL. If you want to use SQL, you must use non-Mapinfo tables and you must issue the SQL through the database facilities available for accessing those external tables.

Non-Mapinfo Tables

For a non-Mapinfo table to show points on the map, it must contain a latitude and longitude on each row, and it must be accessible by an ODBC driver, or through DAO. You must either use data binding, or you must add the points, feature by feature, to the map, by reading one row at a time and creating a feature with Features.Add.

You can also map tables or other files by specifying a routine for the MiDataSetsUnbound data binding event which can retrieve and return the latitude, longitude, and any other data fields as requested by MapX.

MapX does not support SQL. If you want to use SQL, you must use non-Mapinfo tables and you must issue the SQL through the database facilities available for accessing those external tables. You can, however, save the results of such an SQL query as a table, using your normal database facilities, and then use data binding to map it in MapX.

Layers and Datasets and Binding

A layer is a representation of point or region data in the MapX control. As in any mapping system, there can be multiple layers, and lower layers can be seen through transparent areas of upper layers.

MapInfo and non MapInfo tables are bound to layers using data binding. Data binding creates a dataset for the incoming data and then binds it to the layer (which is to say that it draws points at the coordinates specified in the data based on the drawing parameters - symbol, size, etc - set for the layer). Changes to the bound dataset are reflected in the data in the layers to which the dataset is bound when you refresh the map.

Datasets

As mentioned above, external tables are converted to internal datasets which contain a copy of the data from the table - or, at least a copy of as much data as is needed for binding (ID (or GEONAME) and latitude and longitude, at minimum), and any additional fields you specified as needing to be available, usually for constructing labels. Note that such additional fields typically need to be indexed in your external table, or they will not be available for copying to the internal dataset.

Conclusion

The distinction between external tables, datasets and layers can be confusing at first. Just remember:

  • External tables are MapInfo tables, ODBC database tables, or tables you can access by DAO. They contain either MapInfo graphical objects or Latitude and Longitude coordinates which can be used to draw points on the map through data binding.
  • When data binding is performed, a dataset is created which contains a copy of the external table row identifier (GEONAME), the latitude and longitude, and any additional fields you specify in your Datasets.Add field specifications.
  • The dataset created by data binding is bound to a layer, which is a graphical representation of the data in the dataset, displayed in the MapX control.
Copyright © 2004 by Mark Cashman (unless otherwise indicated), All Rights Reserved