TWIAV - Tips & tricks

TWIAV - Tips & tricks

MapBasic Code Samples


On this page you will find some MapBasic code samples, both the program source and the compiled application. Everything on this page is offered "as is" without warranty of any kind, either expressed or implied, including limitation warranties of merchantability, fitness for a particular purpose, and noninfringement.


Unless otherwise stated MapBasic 9.0 has been used to compile the files - this means that the MBXs offered here will only run with MapInfo Professional 9.0 or higher. If you want to use the tools with another (an older) version of MapInfo Professional, you will have to compile the tool using the relevant version of the Mapbasic compiler.


The MapBasic Code Samples Project


The goal of this project is to provide some examples of how to use certain MapBasic functionality - not to offer full-blown applications. The applications below each focus on one 'trick'. You can study the source, modify it to suit your needs and implement it in your own apps.


The following code samples are available here:





Thematic Mapping Sample Code


This application demonstrates how to use MapBasic to create a ranged thematic map.

  • use the Create Ranges statement to calculate the ranges

  • use the Create Styles statement to create styles for the specified number of ranges

  • use the Shade statement to actually create the thematic layer and add it to the Map Window

  • use the Open Window statement to display the Theme Legend window

A sample table - FR_Départements2006.TAB - is used to create a ranged themmatic map for the population density (the column Densité). It should be easy to change the table name, column name and legend titles to apply the code to your own data.



Please see the file below for ThematicMapping.MB and ThematicMapping.MBX.

The table used in the example - FR_Départements2006.TAB - is also included in the zip file:

 ThematicMapping.zip
Thematic Map





More code samples will follow...;-)



What do you think of these code samples? If you have any , please let me know.