I'm doing some research into how I can convert a GML file to MapInfo TAB and then style it using the same script.

I have read about a column called MI_STYLE, however my understanding of this is that it is only used when working with spatial databases (I could be wrong here though!).

I cannot use MapBasic for this task, but do know how to use python and OGR. I also understand the 'language' MapInfo uses to style tables (e.g. Pen, brush etc.)

Does anyone happen to have an understanding on how MapInfo records this information and how it can be modified?

1 Answer 1


The MI_STYLE column is used when you want to save the styling information at a per row level in a spatial database instead of having one global styling information for the entire table stored in the MapInfo MapCatalog in the database.

Basically the styling information is stored in the Map file and then referenced by the individual records in the table.

Unfortunately you can't run a simple MapBasic statement to change the styling of records. You need to grab the individual spatial objects and set the styling information on these and then write them back to the matching record.

This rules out the implementation of a simple workspace to do the styling updates. If you were using MapBasic, you could write a custom MapBasic function and use this in a Update statement directly.

One suggestion would be to use use the tables Default Theme. This is a theme saved to the metadata section of the tab file. This also means that you can write this "structure" yourself.

Here is an example of such a Default Theme saved to a tab file. It's the elements starting with "\DefaultTheme":

"\IsReadOnly" = "FALSE"
"\MapInfo" = ""
"\MapInfo\TableID" = "e89164d0-0604-4c8b-8e81-3093594748da"
"\DefaultTheme" = ""
"\DefaultTheme\Expression" = "VEJKLASSE"
"\DefaultTheme\Expression\IsSimpleCol" = "1"
"\DefaultTheme\ThemeType" = "5"
"\DefaultTheme\Bins" = ""
"\DefaultTheme\Bins\Count" = "1"
"\DefaultTheme\Bins\Bin" = ""
"\DefaultTheme\Bins\Bin\1" = ""
"\DefaultTheme\Bins\Bin\1\From" = "6"
"\DefaultTheme\Bins\Bin\1\BinLinePen" = "Line (1,2,8421504) "
"\DefaultTheme\Apply" = "15"
"\DefaultTheme\DefaultLinePen" = "Line (1,2,0) "

You can create these structures directly from within MapInfo Pro by creating a theme and checking Save as Default Theme View in the last Create Theme dialog.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.