New Tool: MapInfo to QGIS style converter


Hopefully this tool can be of some use to people, as I know it has been very helpful to me since I made it.

As I’m a pretty heavy QGIS user now, and my work place still stores most, if not all, of our data MapInfo TAB format, one  friction point for me using QGIS was having to restyle all the MapInfo layers.  If we only had a handful of layer this wouldn’t be such a pain but we have a lot of tables and it would take me months to go though each one manually and style them.

I thought “there has to be some way I can automate this…” and so the MapInfo To QGIS Style Generator (or mapinfoToQgis.py) was born. Knowing that QGIS uses QML (a XML file format) to store it style information, and that MapInfo was able to export a style string for each object, I compared what QGIS generated for its QML using the same symbol I picked in QGIS as I had in MapInfo.   Almost a 1 to 1 conversion! Once I worked out how to convert MapInfo point size  to QGIS symbol size, and MapInfo colour value to RGB it was just a matter of generating a QML with the correct values.

Long story short, after a bit of clean up and writing a user guide I would like release version 0.1 of the MapInfo To QGIS Style Generator for wider testing.

Here is a quick example of the output.

Step 1: Take One MapInfo table.

Step 2: Run it though mapinfoToQgis.py

python mapinfoToQgis.py WaterFittings.Tab WatterFittings.qml -c FittingType --UseMapInfo

Step 3: Load QML file in QGIS

Result from running mapinfoToQGIS.py

Step 4: Get a beer?

If you are using MapInfo Font symbols or normal MapInfo 3.0 everything should come across almost exactly. mapinfoToQgis.py will use the same fonts in QGIS as you did in MapInfo and select to the correct symbol size. Although if you are using custom MapInfo 3.0 symbols you will get the default QGIS black square symbol,you can just change it to something better after loading the QML.

Currently the program only support converting symbols but I plan on adding line and region support sometime in the future.

The program can be found at https://github.com/NathanW2/MapInfo-to-QGIS-style-generator and more detailed instructions and download link can be found at https://github.com/NathanW2/MapInfo-to-QGIS-style-generator/wiki/Using-MapInfo-to-QGIS-style-generator.

Like I said at the start, hopefully other people will find this tool handy as I know I have.  If you do find it handy let me know, I would love to hear peoples feedback.  Also if you find any bugs let me know in the comments or log a issue on https://github.com/NathanW2/MapInfo-to-QGIS-style-generator/issues

Enjoy :)

Browsers: QGIS vs MapInfo 11


Warning: This post contains small rants! You have been warned.

PBBI have recently released MapInfo 11, the new version has brought one change that I think deserves some attention – even if for the wrong reasons.

MapInfo’s browser window was in need of a very good make over; it didn’t follow normal keyboard conventions, eg holding shift to select rather than ctrl; couldn’t sort via the headers; keyboard navigation was poor; and it looked ugly. PBBI then announced that MapInfo 11 would have a new “improved” browser. I thought “Sweet! About time” and then we got a copy. /sigh

So what’s the problem?

First off it’s slow to resize, this would be due to them using .NET WPF for the new browser (I have never seen a good fast .NET WPF datagrid).

Then we have sorting, which is meant to be the cool new feature. This is not the normal just click on the header to sort the column, no because that would be too easy, you have to right click in the browser, click sort and select the options which then opens a new browser window. um what?

Yes this is a pretty handy feature but no it shouldn’t be the only way to sort, you should have a click on the header kind of sort. This seems to be what people wanted.

Next. No visible scroll progress. When you move the little scroll box on the side the browser waits until you have finished to show you the data. I guess the old browser did this too so why change it!

And finally shift click to select a block of rows doesn’t work, I mean come on this is not a hard thing to do.

Surly you can dock it? Nope!

In the end we have a browser that is pretty much the same as the old one but slower……oh and has alternating row colors.

Overall reaction: Disappointed

Enter QGIS

Now if you are reading this blog you are well aware that I am a huge fan of QGIS, I don’t really make that a secret. So I guess the overall point of this post is to compare the QGIS attribute table (browser) and the new MapInfo 11 one.

Lets run though the same list as MapInfo.

Slow to resize? Nope. Even with a large table open the resize speed doesn’t change.

Header based sorting? Yep. Just click the header and it will sort that column. Multi column sorting is on the to-do list.

Live scrolling (results update as you scroll)? Yep + no lag.

Shift click to select blocks of rows? Sure why not. Or you can hold ctrl to select rows all over the grid.

Docking? Yep and floating so you can put it on a different monitor if you need.

Bonus

The QGIS attribute table has a built-in search/filter box, saves having to run a query and have a new window like in MapInfo if you just want to filter the browser.

The QGIS attribute table (browser)

Extra Bonus
The QGIS browser can even have other UI objects inside the cells. Very bloody handy.

Combo box in browser table.

You can even have a calendar date picker if you want.

Lets review

Feature MapInfo 11 QGIS
Good resize speed. No Yes
Header sorting. Yes [See update] Yes
Multi column sorting. Yes [1] No [2]
Live scrolling. No Yes
Shift click for blocks of rows No Yes
Docking. No[3] Yes

[1] Why does it need to open a new browser window? At least make it an option.
[2] On the to-do list

[3] Yes you can use http://www.pbinsight.com/support/product-downloads/item/windowhelper for this support. It’s a good tool go and download it. I just think it should be built in.

Doesn’t look too good for MapInfo at the moment. QGIS is even accessing the TAB data though ogr. Quick tip: if a free program can access and manage your data faster than you, you are failing.

My work place spends a good deal of money on our annual MapInfo “maintenance” licence, money I would happily send to the QGIS project if I had the choice. Or at least part of it,

Data

Both programs opened a 27000 row .TAB file.

Just for the record I’m not anti-MapInfo. It still has some features that I really like. I just wish they would pick up the game.

Update for 11.03 patch

As promised in my comments this is an update to reflect the new header click sorting in MapInfo Professional 11.03.

The 11.03 patch has added header based sorting, and while the sorting works as expected which is good, there is something a little odd.

What is the typical sort pattern? Left click header, table sorts ascending click again and table sorts descending or vice versa.  Then you normally have any extra sorting stuff in the right-click menu e.g Sort Ascending, Sort Desending, Clear Sort etc.

Go into MapInfo 11.03 left click header, context menu appears 0_o…  I’m not aware of any program that  has ever done that.  A menu on left click is not normal, even crappy ol’ Lotus Notes doesn’t have a menu on left click and Lotus Notes is one really crappy program.

Nuff said.

P.S Don’t talk about your new feature i.e the browser, following normal conventions for browser style windows then do something no one has ever done….and still no shift click block select.

P.P.S I know it may sound like a constant bashing but really something like this should never got passed review. I know UI is hard but come, on a context menu on left click…

Using Python and MapInfo with Callbacks


The other day I posted an entry about using MapInfo with Python and Qt (see https://woostuff.wordpress.com/2011/03/05/mapinfo-map-control-into-qt-python-form/), one big thing that I missed was support for callbacks, which if you want to do anything related to integrated mapping is a must for map tool support.

Turns out it is pretty easy, and today I worked out how.

You will need to create a class in python that looks something like this:

class Callback():
    _public_methods_ = ['SetStatusText']
    _reg_progid_ = "MapInfo.PythonCallback"
    _reg_clsid_ = "{14EF8D30-8B00-4B14-8891-36B8EF6D51FD}"
    def SetStatusText(self,status):
        print status

This will be our callback object that we will need to create for MapInfo.

First I will explain what some of the funny stuff is:

  • _public_methods_ is a Python array of all the methods that you would like to expose to COM eg MapInfo in this case. This attribute is a must for creating a COM object.
  • _reg_progid_ is the name of your COM application or object.  This can be anything you would like.
  • _reg_clsid_ is the GUID, or unique id, for the object or app.  Do not use the one I have, call the following in a Python shell to create your own.
             import pythoncom
             pythoncom.CreateGuid()
             
  • SetStatusText is the MapInfo callback method that is called when the status bar changes in MapInfo.

In order to use the class as a COM object we have two more steps to complete, one is registering the COM object and the other is creating it.

First, in oder to register the object we call the following code from our main Python method:

if __name__ == "__main__":
    print "Registering COM server..."
    import win32com.server.register
    win32com.server.register.UseCommandLine(Callback)
    main()

This will register the COM object which will mean it can then be creating for use by MapInfo.

In order to create our callback in Python we call:

callback = win32com.client.Dispatch("MapInfo.PythonCallback")

and set it as our callback object for MapInfo:

mapinfo.SetCallback(callback)

So after all that the final code looks like this:

def main():
    from PyQt4.QtCore import *
    from PyQt4.QtGui import *
    from win32com.client import Dispatch
    import sys

    app = QApplication(sys.argv)
    app.setAttribute(Qt.AA_NativeWindows,True)
    wnd = QMainWindow()
    wnd.resize(400, 400)
    widget = QWidget()
    wnd.setCentralWidget(widget)
    wnd.show()

    handle = int(widget.winId())
    mapinfo = Dispatch("MapInfo.Application")
    callback = win32com.client.Dispatch("MapInfo.PythonCallback")
    mapinfo.SetCallback(callback)
    mapinfo.do('Set Next Document Parent %s Style 1' % handle)
    mapinfo.do('Open Table "D:\GIS\MAPS\Property.TAB"')
    mapinfo.do('Map from Property')

    app.exec_()

class Callback():
    """ Callback class for MapInfo """
    _public_methods_ = ['SetStatusText']
    _reg_progid_ = "MapInfo.PythonCallback"
    _reg_clsid_ = "{14EF8D30-8B00-4B14-8891-36B8EF6D51FD}"
    def SetStatusText(self,status):
        print status

if __name__ == "__main__":
    print "Registering COM server..."
    import win32com.server.register
    win32com.server.register.UseCommandLine(Callback)
    main()

and the result is a map window and information printed to the console.

Information from MapInfo callback

I think Python could be a good language to prototype MapInfo based app, or even build a whole app itself. If you do end up making something of it let me know I am quite interested with what people could come up with.

MapInfo map control into Qt Python form


Tonight for a bit of fun, or shits and jiggles as we say here, I thought I would try and embed a MapInfo map control into a Qt python widget (although I should be studying, but it’s Saturday night) .

Turns out it is pretty easy!

pls send me teh codez? OK here you go.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from win32com.client import Dispatch
import sys

app = QApplication(sys.argv)
app.setAttribute(Qt.AA_NativeWindows,True)
wnd = QMainWindow()
wnd.resize(400, 400)
widget = QWidget()
wnd.setCentralWidget(widget)
wnd.show()

handle = int(widget.winId())
mapinfo = Dispatch("MapInfo.Application")
mapinfo.do('Set Next Document Parent %s Style 1' % handle)
mapinfo.do('Open Table "D:\GIS\MAPS\Property.TAB"')
mapinfo.do('Map from Property')

app.exec_()

The above code will load MapInfo and open the property layer into the Qt Widget control, with the result below.

MapInfo map in python Qt based form

So this means you don’t “always” have to write your MapInfo based apps in C# or C++; of course I already knew this as anything that can use OLE and provide a native window handle to MapInfo will work, I just never tried it.

Creating an instance of a MapInfo COM object in .NET – Speed Tests


A while ago I posted about how to create an instance of MapInfo in .Net, If you missed those posts then they can be found here.  In these posts I outlined how you can create a instance using three different methods, in the reflection based post I said that one of the disadvantages of doing it this way was that it was slower.   I said this due to just my observations but I thought it would be a good idea to put it to the test and show the speed difference.

I created a simple project to test and show me the results of three different things: Speed of complied MBX, calling a MapBasic function though the Do and via the interface (see posts 1 & 3) and calling Do and Eval via reflection (see post 2)

The code is simple, and is posted at the bottom of this post, the command “Fetch Next From {Table}” is called a number of times: 100;200;300;500;1000;2000;5000 and each block is timed.

After running each iteration set 3 times, these are the results :

SpeedTests

Behold my fancy graph making skills….or lack there of.  The time is in seconds, so the 0.032 in the Interface pass 1 is 0.032 seconds for 200 iterations which is still pretty quick.  You’ll notice that using the reflection based method starts to really take its toll when you are doing 5000 iterations, mind you ~1 second is still pretty quick.

The Mapbasic code I used:

Declare Sub Main
Declare Function Time(count as Integer) as Float
Declare Function GetTickCount Lib "kernel32" () As Integer

Sub Main
   Dim pass as Integer
   pass = 0
	Dim a,b,c,d,e,f,g as Integer
   a = 100
   b = 200
   c = 300
   d = 500
   e = 1000
   f = 2000
   g = 5000

	Do While pass <= 2
       Print "====PASS " + pass + "========="
       Print Time(a)
       Print Time(b)
       Print Time(c)
       Print Time(d)
       Print Time(e)
       Print Time(f)
       Print Time(g)
		pass = pass + 1
   Loop
End Sub

Function Time(count as Integer) as Float
    Dim a as Integer
    Dim b as Integer
	Dim i as Integer
	a = GetTickCount()
	For i = 0 to count
       Fetch Next From Untitled
    Next
	b = GetTickCount()
	Time = (b - a) / 1000
End Function

and the C# code:

class ReflectionMapInfo
    {
        private readonly object mapinfo;

        public ReflectionMapInfo(object mapinfo)
        {
            this.mapinfo = mapinfo;
        }

        public void Do(string commandstring)
        {
            this.mapinfo.GetType().InvokeMember("Do", BindingFlags.InvokeMethod,
                                                                null, this.mapinfo,
                                                                new[] {commandstring});
        }
    }

    class Program
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int GetTickCount();
        static MapInfoApplication mapinfo = new MapInfoApplication();
        static ReflectionMapInfo reflectionmapinfo = new ReflectionMapInfo(mapinfo);

        static void Main(string[] args)
        {
            mapinfo.Do(@"Open Table ""C:\Users\Woo\Documents\Untitled.TAB""");

            int pass = 0;
            while (pass <= 2)
            {
                Console.WriteLine("Interface Test, Pass " + pass + "Count 100 " + Time(100));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 200 " + Time(200));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 300 " + Time(300));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 500 " + Time(500));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 1000 " + Time(1000));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 2000 " + Time(2000));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 5000 " + Time(5000));
                pass++;
            }

            pass = 0;
            while (pass <= 4)
            {
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 100 " + ReflectionTime(100));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 200 " + ReflectionTime(200));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 300 " + ReflectionTime(300));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 500 " + ReflectionTime(500));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 1000 " + ReflectionTime(1000));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 2000 " + ReflectionTime(2000));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 5000 " + ReflectionTime(5000));
                pass++;
            }
            Console.ReadLine();
        }

        public static double Time(int count)
        {
            int start = GetTickCount();
            for (int i = 0; i < count; i++)
            {
                mapinfo.Do("Fetch Next From Untitled");
            }
            int end = GetTickCount();
            mapinfo.Do("Fetch First From Untitled");
            return (end - start) / 1000d;
        }

        public static double ReflectionTime(int count)
        {
            int start = GetTickCount();
            for (int i = 0; i < count; i++)
            {
                reflectionmapinfo.Do("Fetch Next From Untitled");
            }
            int end = GetTickCount();
            reflectionmapinfo.Do("Fetch First From Untitled");
            return (end - start) / 1000d;
        }
    }

Creating an instance of a MapInfo COM object in .NET – Speed Tests


Blog has now moved to <a href="http://nathanw.net&quot;A while ago I posted about how to create an instance of MapInfo in .Net, If you missed those posts then they can be found here.  In these posts I outlined how you can create a instance using three different methods, in the reflection based post I said that one of the disadvantages of doing it this way was that it was slower.   I said this due to just my observations but I thought it would be a good idea to put it to the test and show the speed difference.

I created a simple project to test and show me the results of three different things: Speed of complied MBX, calling a MapBasic function though the Do and via the interface (see posts 1 & 3) and calling Do and Eval via reflection (see post 2)

The code is simple, and is posted at the bottom of this post, the command “Fetch Next From {Table}” is called a number of times: 100;200;300;500;1000;2000;5000 and each block is timed.

After running each iteration set 3 times, these are the results :

SpeedTests

Behold my fancy graph making skills….or lack there of.  The time is in seconds, so the 0.032 in the Interface pass 1 is 0.032 seconds for 200 iterations which is still pretty quick.  You’ll notice that using the reflection based method starts to really take its toll when you are doing 5000 iterations, mind you ~1 second is still pretty quick.

The Mapbasic code I used:

Declare Sub Main
Declare Function Time(count as Integer) as Float
Declare Function GetTickCount Lib "kernel32" () As Integer

Sub Main
   Dim pass as Integer
   pass = 0
	Dim a,b,c,d,e,f,g as Integer
   a = 100
   b = 200
   c = 300
   d = 500
   e = 1000
   f = 2000
   g = 5000

	Do While pass <= 2
       Print "====PASS " + pass + "========="
       Print Time(a)
       Print Time(b)
       Print Time(c)
       Print Time(d)
       Print Time(e)
       Print Time(f)
       Print Time(g)
		pass = pass + 1
   Loop
End Sub

Function Time(count as Integer) as Float
    Dim a as Integer
    Dim b as Integer
	Dim i as Integer
	a = GetTickCount()
	For i = 0 to count
       Fetch Next From Untitled
    Next
	b = GetTickCount()
	Time = (b - a) / 1000
End Function

and the C# code:

class ReflectionMapInfo
    {
        private readonly object mapinfo;

        public ReflectionMapInfo(object mapinfo)
        {
            this.mapinfo = mapinfo;
        }

        public void Do(string commandstring)
        {
            this.mapinfo.GetType().InvokeMember("Do", BindingFlags.InvokeMethod,
                                                                null, this.mapinfo,
                                                                new[] {commandstring});
        }
    }

    class Program
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int GetTickCount();
        static MapInfoApplication mapinfo = new MapInfoApplication();
        static ReflectionMapInfo reflectionmapinfo = new ReflectionMapInfo(mapinfo);

        static void Main(string[] args)
        {
            mapinfo.Do(@"Open Table ""C:UsersWooDocumentsUntitled.TAB""");

            int pass = 0;
            while (pass <= 2)
            {
                Console.WriteLine("Interface Test, Pass " + pass + "Count 100 " + Time(100));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 200 " + Time(200));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 300 " + Time(300));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 500 " + Time(500));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 1000 " + Time(1000));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 2000 " + Time(2000));
                Console.WriteLine("Interface Test, Pass " + pass + "Count 5000 " + Time(5000));
                pass++;
            }

            pass = 0;
            while (pass <= 4)
            {
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 100 " + ReflectionTime(100));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 200 " + ReflectionTime(200));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 300 " + ReflectionTime(300));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 500 " + ReflectionTime(500));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 1000 " + ReflectionTime(1000));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 2000 " + ReflectionTime(2000));
                Console.WriteLine("Reflection Test, Pass " + pass + "Count 5000 " + ReflectionTime(5000));
                pass++;
            }
            Console.ReadLine();
        }

        public static double Time(int count)
        {
            int start = GetTickCount();
            for (int i = 0; i < count; i++)
            {
                mapinfo.Do("Fetch Next From Untitled");
            }
            int end = GetTickCount();
            mapinfo.Do("Fetch First From Untitled");
            return (end - start) / 1000d;
        }

        public static double ReflectionTime(int count)
        {
            int start = GetTickCount();
            for (int i = 0; i < count; i++)
            {
                reflectionmapinfo.Do("Fetch Next From Untitled");
            }
            int end = GetTickCount();
            reflectionmapinfo.Do("Fetch First From Untitled");
            return (end - start) / 1000d;
        }
    }

MapInfo Window Manager Version 1 – Coming Soon!


Since the release of version 0.5 of my MapInfo Window Manager I have been working on the new version which will be Version 1.0 and to be released soon. It has some new features, bug fixes and a improved UI.

Some Screenshots and feature run down:

Windows Tab: (Shows Open Windows)

Features:

  • Double click to bring window to the front.
  • F2 turns on rename function for the selected window.
  • Supports all windows types, even info and stat windows. (Version 0.5 just supported Maps and Layouts)
  • Groups can be sorted alphabetically in ascending or descending order.  (A and D buttons)
  • Groups can be sorted individually.
  • All windows can be cloned except for Special windows.
  • Shows count of windows open in each group.
  • Windows can be locked to stop accidental closing.
  • Fancy icons :)

Closed Windows Tab: (shows closed windows allows them to be reopened)

Credit to Peter Horsboll Moller of PBBI MapInfo for this idea, which came from his MapBasic Window Helper tool.

Features:

  • Records all windows as they are closed, letting you restore the window later. (Handy for accidentally closing a legend window)
  • Double click to reopen window.

Settings tab: (Pretty boring just lets you change some settings)

Features:

  • Allows the program to be auto loaded and the tool to be shown when MapInfo loads.
  • Allows the program to store the position of itself.

About Tab: (Pretty boring also, just some info about the app and where to contact me)

Features:

  • It’s an about page, what features can it have!? :)

I have been testing my Window Manager at home and at work, I use it almost everyday, and with some people that I know.

However I would like to get some more testing done by some other people to make sure that Version 1.0 is good and stable.  I am also still look out for anymore ideas that I could throw into Version 1.0.

If you would like to give the beta a test and do some bug hunting for me, or likewise if you have a feature you would like to see rolled into Version 1.0, please contact me on here or by email (which you can see in the about tab page screenshot above)

Just for fun:

Here is a comparison screenshot of the old and new one:

Unofficial MapInfo feature request list – Updated Again!


EDIT:

So nothing official was decided however I really like the layout and usability of http://getsatisfaction.com/mapinfopro and Bill Theon added my wish list to the header of MapInfo-l so I guess we can use it for a while until something better comes along.   I am looking a buying some paid hosting and moving my blog and creating a better wish list, something that I have more control over.  Something like http://www.opensourcerails.com/projects/1785-OpenMind but money is tight so I don’t think that will happen for a while.

The other day I was looking around some GIS websites and found that ESRI have a place where people can go and post feature requests,bugs,ideas about all the different ESRI products.  Looking around I wasn’t able to find anything like this for any MapInfo products, so I thought it might be a good idea to start one.

A lot of information flows though the global MapInfo-l message board, things that would be nice to have down as feature requests or bugs so that people can comment and PBBI can really see what people would like in their products.  I am aware that you can send feature requests though the MapInfo Professional software however I think having a community effort would be much better as you can quickly see what other people
have thought of and if you support that idea also, which in turn lets PBBI see what the community wants.

I have trailed a few different feedback sites and I have gone with a site called getsatisfaction.com, it is user friendly, lets you post comments (even what mood the request or bug puts you in, handy to see what really bugs people). The only thing I wanted and it didn’t have is a vote up and vote down feature, it has it in the paid version put I am only using the free version because I don’t have a spare $20 a month.  My thoughts were, if you would like to see a feature or a bug fixed post a comment on the item and use the smiley face (you’ll see what I mean on the site) to show you support the idea.

I have added two new items which I would like to see, please feel free to add more.  Hopefully we can start building up a list of featuresthat we would like see, or bugs that we find.

New MapInfo Pro Tool – Window Manager


Over the last couple of weeks I have been working on a new MapInfo Professional tool called Window Manager, it is nothing big but I find it very handy.  The window manager shows all the open map and layout windows in a visual WPF tree view control and gives the users quick access to basic functions when dealing with windows in MapInfo eg Rename and Clone etc.

Screenshot

The current version (0.5) is only really a preview version and still has a little bit of work to make it a bit more polished looking, however I have tested the clone, close,rename and bring to front commands a lot as I use this tool all the time and it feels stable.  I am releasing it early rather than waiting for a couple of more weeks for a couple of reasons 1) Fear of forgetting to release it due to being busy 2) Would like to see what other people would like to do with a tool like this.

The wiki page with more details, download link and how to install instructions can be found here: http://code.google.com/p/nathansmapinfoprojects/wiki/WindowManager

This tool uses WPF and in doing so needs .Net 3.5, must people should have this so it shouldn’t be a big deal.

If you find any bugs or would like to see something added please let me know by commenting on this blog post, on the wiki page or on the issue tracker on my Google code page.

MapInfo Pro Feature Requests – Things I would like to see – Better thematics


I have been working on a rather large mapping project over the last couple of months, and that thought I would write a blog post about some features that I would like to see implemented in MapInfo Pro to make map making a little bit easier.  This could get long so I might break in down into different posts.

Let us begin.

Linked thematic map templates:

Thematic maps are great, I use them all the time but unfortunately they are a big pain in the butt when it comes to using and applying them across a large range of maps and workspaces and using them to keep map updated.

I will elaborate a bit on that last point with a scenario.  Lets say you have a table with a series of maintenance points each with one of the following values:

  • Complete
  • Started
  • Failed

Now we can create a thematic map to show these values:

Sweet, now we can use the Save As… template option so we can save it as something like “Maintenance – Status – Standard”, we do this so that we can apply it to other maps later on.

Now I want to save a workspace because I have all sorts of maps open that need to keep their formating, so I do a Save Workspace…. as something like “Jobs.wor” , a couple of weeks later I would like to make a new set of maps, (say for a gridded map book for the field) using the same template so that I am using the same standard colors across all my maps.   I open the table, make my grid and apply the template to the maintenance layer, everything looks good, now I save the workspace… “Jobs Map book.wor”.  So by this time we have two workspaces: “Jobs.wor”;“Jobs Map book.wor”.

After a couple of weeks I realize that I have to change one of the colors that we use to show the job status.  So we open up the Maintenance.tab and apply the “Maintenance – Status – Standard” template that we have already set up, then we change the color of the Completed job status to yellow, and do a template Save As… and save it as the same name as the old template, overwriting the old one.

Now I want to generate my map book again to bring it up to the new standard colors, I open up the “Jobs Map book.wor” workspace, and what! my colors in the thematic for the maintenance job status are still the same as they were before I updated my template.  Opening up the “Jobs.wor” workspace I find the same thing, there is a disconnection between the template and where it is used.

The reason this happens is because when you save the workspace it hard codes the thematic values right into the workspace with the map. something like this:

shade 1 with Values values
“Complete” Symbol (34,16711680,12) ,
“Failed” Symbol (34,65280,12) ,
“Started” Symbol (34,255,12)
default Symbol (40,0,12)   # color 1 #

meaning that each map in the workspace now has its’ own independent thematic map regardless of the template changes.  If I would like my two workspaces to have the template  new colors I must open both of them and remove the thematic on each map that uses it and reapply it and save.  The problem with this is that it requires the user of the workspace to be aware of the changes in the template and reapply them.  In a multi user environment this becomes difficult.  I also becomes a problem when you have a large workspace 20+ maps all using the same thematic, that is 20+ changes every time you need to make a style change.

What I think would work

My idea is just like something Peter Horsboll Moller and Gentreau in this Mapinfo-l thread suggested beck in 2008, a syntax and command addition to MapBasic.
Something like the following:

Shade <tablename> Layer <layername> Using Template <full path to template> Column <column name>

This means you would be able to store templates in one place and any time somebody opens the workspace, the theme file is read and applied to the map, meaning you will always have the latest style changes.  By using the full path or just the theme name you could store theme files on a network drive or just with the workspaces if it is only going to be used for a selected job with lots of workspaces.

You could also store something like this in the tab file meta data, to use a theme file as the default shading:

\defaulttheme\path = “<full path to template>”

Why I think this word be good.

As it’s pretty obvious from the scenario that I outlined, if you are working on a large mapping project with a table and thematic being used in all the workspaces.  The ability to update just the template and not have to worry about updating each  independent  thematic stored for map in each workspace would greatly improve map making speed.  This feature become even more needed when projects become old and not knowing which workspace and maps need to be changed.

Notes.

Just saving the path to a theme template file would not always be needed(sometimes templates aren’t even needed, for one-off jobs), so hard coding the thematic into the workspace still needs to be an option, but by default it should save a template and the path to the template first rather than hard coding.

Please let me know what you think.

I am writing this as a public blog rather than just sending it straight to MapInfo because I would like to see what other people also think.  Maybe this idea can be expanded? Maybe you would like to say why it shouldn’t be done? Doesn’t matter the reason, let me know.  All comments are welcome, the more people behind an idea the better.