MAPINFO APPLICATIONS

I have collected in this site some of the most useful code I have written duringthe past years, but for some reason Inever put in public. Some of it was written for ad hoc purposes for a unique need, some of itwas developed a little further fora better interface. No matter how smooth the code looks, eventually you are most likely to run into an annoying feature or a bug of some kind. To overcome these hardfeelings, all the code in this page setis released under GNU general public licencing. Forthe time being there is not much hope for me to find time for further developement of this code, so you are pretty much on your own with it.

For me as an author it would be kind if you could drop an e-mail to let me know if you found some of thiscode useful and to send methe link to your enhanced version forfurther developement. Also if some of my stuff burns your computer and ruins your day, it would be nice tolet the others know as well. (Not to mention thekind gesture from you of fixing the bug and sending me a patch.) Code itself isa little stingy with comments, but most of thetime pretty straightforward. I have tried to include a short descriptionof each set below. All zip files containalso a mbx-file compiled with MapBasic 5.0.


 
 

ENHANCEMENTS
This section contains small applications that make my work with MapInfoa little easier.

DynCols.zip
This little application adds dynamic RowID and/or Coordinate fields into yourbrowser. I have found theseoperations very annoying to do with the Browser menu. Note: application sleeps in Window menu.
DropCols.zip
Once in a while I had toclick tens if not hundreds of times in Table => Maintenance dialogbox when trying to remove multiple fields. This app deletes fields you select froma multilistbox.
Recover.zip
This application recovers deleted records that are shown grey inthe browser window. Application may be downloaded fromthe Directions Mag site as well. Note: application sleeps in Edit menu.
viewSettings.zip
This application adds some items to the Help menu to open different MapInfo and MapBasic setting files. It helps a little bit from time to time when these files come into a frequent use.
MRUwor.zip
Print layouts are saved in workspaces only. A handy way not to forget where to find specific workspace that contains layout for your printout, is to add name of your workspace into your layout window before printing. This is very common in office software, but unfortunatelly not available in MapInfo.
This application adds the name of most recently used workspace (and optional a date tag) into the layout window. To keep MapInfo 'look and feel', some information is needed to dig out from mapinfow.prf. Since prf file is undocumented and most likely to change in structure and location, some tricks to deal with the situation is briefly outlined. Note: application sleeps in Layout menu.

UTILITIES

FocalGrd.zip
Yet another grid maker. This one makes square or hexagonal tesselations with opportunity to have also a focal grid. Focal grid is an easy way to calculate local averages of grid neighborhood and has the same type of effect as neighborhood affected interpolation modelling method. The focal self overlaping grid is used for gathering values, which are thematized in smaller grid.
FindClosest.zip
This application compares two tables and finds for each unit of a table the closest unit in the other table.
RegComp.zip
This application compares two tables containing area objects and calculates the amount of overlapping. Results are summed up according to userdefined column.
CompTabs.zip
This application compares two data from user defined tables columns. Very useful when trying to track possible changes in different versions of data.

MAPINFO INTERNALS
This section contains code that began astests of the Error function. It turned out that it worked far beyond normal error strings and made all dll string resourcesavailable.

ErrCodex.zip [727 kb]
This file contains a tool to view and extract error & other codes from your localized MapInfo version. There is also a set of different languages included that kind listers have mailed me during short test period. Note: application sleeps in Help menu.
UniversalDialogs.zip
This is a short demo of how to built some language specific stuff from MapInfo dll resources into your own application.
API_resource.zip
This set of code is the reason why testing wasn't brought any further. As usual,everything becomes much more effective if you toss MapBasic over board. With theset of Win32API functions you could make your own wild localization of MIpro. Since MapInfo resource files and the strings included in ErrCodex are most likely proprietary stuff,licenced user shouldn't be doing this anyway. I didn't either. Note: Testcode for various API functions with hardcoded values; no interface.

RUNNING OTHER SOFTWARE THROUGH MAPINFO
This section contains a couple of potentially useful examples of riding on glory of other software from MapInfo.

batchUT.zip
This app takes advantage of IMUT.exe, which is stand alone program known as Universal Translator that is shipped with MapInfo. Since program is lite version of very robust FME software, some of the tricks explained in FME documentation are very useful for UT as well. The app here is actually just another interface for IMUT.exe that allows batch processing and external FME control file. Someof my own control files are included as examples.
Tip: Since the creation of your first control file from scratch is too big a task, you should use theGENERATE functionality that is built in. The general form for generating processing command line argument is as follows:
"IMUT.EXE" Generate <sourceformat> <destformat> <sourcefile> <mappingfile>
so generating FME file named mapping.fme for MapInfo native format from source file foo.dgn looks like this:
"IMUT.EXE" Generate IGDS MAPINFO foo.dgn mapping.fme
For excursions in FME world I suggest reading manual at SAFE software site also some discussion on topic may be found at MI-L archives.
P.S. If you figure out how to create regions from linework during the translation process, let me know aswell.
GhostPrint.zip
This is the way I used to create high resolution images from MapInfo. Usage requires the installation of GhostScript software and at least one functioning PostScript driver. Since creation of raster hasbeen enhanced in latest versions of MapInfo, the bestuse for this app is thecreation of PDF or AI files.
I haven't followed what's new in GhostScript latelly, but by the time this app was written I wasn't quite satisfiedwith the AI file creation. Conversion was made with file ps2ai.ps which is copied under name ps2ai4mi.ps and modified for my conversion purposes. For obtaining GhostScript software and further information on usage check out the GS homepage at University of Wisconsin.Tip: Resolution control is a combobox (even though MapBasic doesn't have one).

FINLAND SPECIFIC
Coordinatesystem definition for Finnish KKJ in first shippings of Mapinfo was awfully inaccurate for GPS based data. The cure was to introduce a new ellipsoid parameters for better accurancy.But the cure caused different troubles that lost for good about 99%of ordinary MapInfo users. Today entire municipalities work with inaccurate or even worse, mixed tables. The official conversion application exports table to mif, changes the coordsys clause and imports file back to native format. Since this is irresponsible, unproper (and un-whatever) way to handle the task I have two probably helpful applications.

KKJ_convert.zip
This app lets you convert one file at a time from old to new or new to old coordsys precision. This was done before I really knew the native file internal stuff, so I couldn't know that the task is actually to put two parameters as float values into specific places in .map file. This one works anyway, but if you are curious take a look at here starting from offset Ox190.
KKJ_wizard.zip
This is a batch tool for conversion. Since it was one of my first ones with API functions it probably isn't that neat and possibly needs some tuning for your purposes. Needless to say that I strongly suggest taking backups and doing some additional test before doing any large scale conversions.I used it myself to convert all MapInfo data from some 30 computers so it is really effective. It also removes read-only tags when ever possible. Note: Dialogs in Finnish.
MAMI.zip
This application is used to take advantage of Maanmittauslaitos (National Land Survey of Finland) mapdata. Since the buggy, commercial MAMMA software that is used to take contains some proprietary fonts and other resources this is only the first step to make the map look proper. If someone has already drawn all required mapsymbols into ttf-files, I would happy to modify the code to add them during conversion.
RegImage_helsinki.zip
This application registers raster images using file names. File names containing proper information about location of map tile may be registered in user defined manner and directory location. Registering is made for entire directory contents. Image sizes are read from tiff or jpeg file binaries.
This application is made with the logic of Helsinki map indices, but I assume all tiled raster maps have naming conventions with reasonable logic to follow. The place for your own code is clearly marked.

MISCELLANOUS

sun_moon.zip
This application calculates the location and illuminance of sun and moon. Model for these heavenly bodies is translated from FORTRAN source published in United States Naval Observatory Circular No. 171 by P.M.Janiczek and J.A.DeYoung. I can think of about million things to use this model data if I only had as must spare time as I used to. The most obvious would taking the locations from the map and combine them with the following shadow app.
shadow.zip
This code creates shadows for region objects. I never had time to make an interface for this one, so it uses hardcoded azimuth and altitude values as well as column name for building heights.
ColorWiz.zip
This is an tool for viewing different color tables. It also have option to snitch existing color tabels from GIF images, MicroStation TBL files and PhotoShop ACTs. I still haven't found way to change MapInfo color tables on the fly, which would be essential for professional color usage. The only way seem to be relocating mapinfow.clr file and pointing your desired table when confused program prompts you to.
Spy_dlg.zip
If you don't have Spy software that is shipped with VC++, you can get some assistance from this app for controlling ids of various MapInfo dialogs. Not very robust, but better than nothing. Note: application sleeps at Help menu.