GAMS [ Home | Downloads | Documentation | Solvers | APIs | Tools | Model Libraries | Resources | Sales | Support | Contact Us | Search ]

Table of Contents

GAMSMAP: Exporting to MapInfo Maps


GAMSMAP is a collection of GAMS routines and data files to create specific MapInfo© maps. The tools grew out of a project we did with one of our clients in which we sought to speed up by replacing hand drawn maps by automatically created maps. Because of the proprietary nature of the work, we are not able to release the geographical and related data, but provide the same general capabilities for publicly available data.

GAMSMAP is not meant as a pure stand-alone mapping tool. Rather, the purpose is to show our users how GAMS can be used to interface with mapping software such as MapInfo.

The GAMSMAP tools consist of three GAMS routines (region.gms, point.gms, and link.gms) with which one can create region, coordinate, and link type of maps. GAMSMAP contains a database of objects, which specify which objects the user can plot. Currently the objects consist of public-domain mapping data, such as world countries, US states, world country capitals, and US state capitals. Mapping capabilities of GAMSMAP are limited to these data sets. Users may experiment with the GAMSMAP routines by adding new data sets, although the process is quite awkward at the moment.

The routines in GAMSMAP are modular in design. That is, customized maps can be created by building individual map layers, for example US states, world countries, US state capitals, or world country capitals, and then merging them within the mapping software. This feature allows maps to be changed without large effort, if for example only an object on one layer is to be changed from one map to another.

GAMSMAP is contributed software and not supported by GAMS, although we welcome your comments and suggestions. It was created by Michael Bussieck and Armin Pruessner.

Note: GAMSMAP is not to be confused with the GAMSMAP model paperisation and cleanup tool developed by Bruce McCarl.

Sample Maps

With GAMSMAP users can create a wide variety of maps on the fly. We will give several examples which show how easily and quickly custom maps can be created.

Example 1: Region Map showing world literacy rates

Suppose we want to show a region map showing the world literacy rates in varying shades of red, for example a deeper shade of red implies a higher level of literacy and a lighter shade a lower rate. We have taken sample data (from 1994) provided with the MapInfo Professional software. We remark that this data is not necessarily accurate and is used merely for illustration purposes. The resulting map using GAMSMAP is

World Literacy Rates (1994).

We remark that certain countries do not have any shading and are in light yellow. This is because no data exists for these countries in the sample data file. The data file is included in the file which users can download.

Example 2: Point Map showing populations of world capitals

Our second example shows the populations of various world capitals. The data is also obtained from free data included with MapInfo Professional and is from 1994. Again, we want to emphasize that this data is not necessarily accurate and is used for illustration purposes only. This map involves merging two component maps: one a region map showing the countries of the world and the second the actual point map. Different population sizes are depicted by different sized points: larger populations are shown by larger points and smaller populations by smaller points. The resulting map using GAMSMAP is shown below:

Populations of World Capitals (1994): Map A

GAMSMAP also has the option to depict numerical point data by different shades. The user specifies the point size and different numerical values are shaded with different intensities as in the region example. This option is shown in the following map:

Populations of World Capitals (1994): Map B

GAMSMAP has the option of using different scales to depict numeric data. This feature is discussed in detail in the GAMSMAP Users Guide.



A windows-based GAMS system (Distribution 21.0 or later) is required to run all GAMSMAP routines and a MapInfo system (Version 6.50 or later) to view all resulting maps. While it may be possible to import maps created by GAMSMAP using other mapping software, it is recommended that users have a MapInfo viewer installed on their machine. Earlier versions of GAMS do not support the – feature to initialize environment variables from the command line. As we will see, this feature is essential to using the GAMSMAP routines. For details on this feature, see the GAMS Distribution 20.1 release notes.

Downloading GAMSMAP and the Free Viewer from MapInfo

The file contains GAMSMAP routines, the region, point, and link data base, documentation, and sample numeric data.Users who do not own a licensed copy of MapInfo, may download a free viewer from the MapInfo site. The software,MapInfo Pro Viewer, does not allow as much flexibility in viewing maps as the full MapInfo software. For example, it does not allow component maps to be merged. It is however useful in showing simple region maps and shows the capabilities of GAMSMAP. A GAMSMAP Users Guide in PDF format is available online. It is also included in the file under the Documentation/ subdirectory. To view it you will need the free Adobe Acrobat Reader.

Compatibility With Other Mapping Software:

The GAMSMAP routines create standard .MID and .MIF files which can be imported to many different mapping software. Although we made use of MapInfo because our client was using this particular software, users should be able to use other mapping software, although we have not actually tested this. We made use of the free tab2tab.exe executable program to convert .MID and .MIF files to MapInfo readable .TAB files. It is open source available software from MITAB. If users prefer to use other mapping software besides MapInfo, they are encouraged to do so.


Once users have downloaded the file, Please follow the instruction for an incremental update. After the installation, these files have been added to your GAMS system directory:

Sample Commands

We will now show the GAMSMAP calls used to create the examples listed under Sample Maps. Users should be able to recreate the maps by following these instructions.

Example 1: Region Map showing world literacy rates

If users wish to reproduce the map shown in the earlier example, the command is:

gams region --data=world --datafile=SampleData/world_lit.txt --colp=red --tabfn=worldlit

The option –data=world specifies that our region objects are world countries. The –datafile command points GAMSMAP to the numeric data file world_lit.txt located in the SampleData/ subdirectory, –colp specifies the color of the regions with positive numeric value, and finally –tabfn specifies the MapInfo output .TAB filename.

Example 2: Point Map showing populations of world capitals

The commands for point maps are similar. First we will create the world map by:

   gams region --data=world --tabfn=world

which will create a map called We then create the point map:

   gams point --data=worldcaps --datafile=SampleData/worldcaps_pop.txt --colp=yellow --tabfn=worldcappop

By default, we create a point map where numeric data is reflected by different point sizes. If we wish to create a point map where numeric data is reflected by different shading (as in Example 2, Map B), our command is:

   gams point --data=worldcaps --datafile=SampleData/worldcaps_pop.txt --colp=blue --tabfn=worldcappop --type=color --size=15

The different point type map is invoked by the command --type=color. Also, we use the default scaling. Finally, we must specify a point size (by --size=15). Otherwise our points will not be visible.

All GAMSMAP –options are listed in the GAMSMAP Users Guide. Readers are referred to it for detailed information on all options.