Thursday, October 23, 2008

Good to know

Just wanted to thank Hampden GIS/IT for a very valuable MapInfo tip. As I've said a few times, I'm not a fan of workspaces, but there is something you can do with a workspace that you can't with any other proprietary program file I've worked with (e.g. *.dwg, *.mxd, *.map). You can open it up in Notepad or WordPad. This is excellent for fixing broken paths (which I'm needing to do right now). It's actually neat to read through it, because it is like reading a program...a LISP or FORTRAN program. Sort of takes me back to working with AutoCAD commandline. Personally, I think commandline is more efficient than searching for icons...This is probably a good workaround to the Named Views problem. Pick a view that works at then use map basic to set it...even copy and paste it into the workspace in Notepad. That's much better than saving it at the application level. In fact to rebuild this workspace, I'm just copying the Map Basic code because it wouldn't load anymore. That's definitely a mark in the plus column for MapInfo.

Still I couldn't resist an experiment. I started a new workspace with one Map Window and one Layout Window. Saved the workspace, then added a piece of text to the layout, closed the layout window and saved as a new workspace. I compared the two in Notepad, and the layout was gone in the second workspace. I was secretly hoping that it just retained all the commands, but of course that really isn't efficient to save all the commands. Oh well, nothing is perfect. In the end, I shouldn't be trying to fit MapInfo into an AutoCAD ArcGIS mold, all three are different programs. It's useful to know the quirks so that I can compensate when using any of the programs.

3 comments:

Hampden GIS/IT said...

haven't visited the blogosphere in a while- thanks and you're welcome!

Peter Horsbøll Møller said...

You are right. The workspace doesn't hold all the commands that you have done since you started MapInfo. The workspace is a snap shot of how the windows looks when you save the workspace.
This means that the workspace will contain a reference to all the tables, queries (if you have turned this on), windows (maps, browsers, layouts etc.) and some other stuff.
If you want to see the work you have done, you should open the MapBasic Window (Options > Show MapBasic window).
MapInfo will then records most of what you are doing. However not every command is recorded. But most of the simple commands executed thru the menu items will be recorded.
What you will see in the MapBasic window is the MapBasic commands executed to perform the action you asked MapInfo to do.
You will quickly see that these commands look like the workspace. That's because the workspace also contains MapBasic statements.

David S. Lamb said...

Thanks for the information.

Another good description that I heard/read of a workspace is to think of it more like a Macro and not a project file. Because, like you say, it is essentially the MapBasic commands stored in a file. When the workspace loads, each command runs to rebuild that last save.

I actually appreciate this approach, because I find commandline to be more eficient and faster (if I used MapInfo more regularly).

I'll double check to make sure that the prompt is activated to save the workspace before closing a window.