MapInfo Workspaces:  Tips, Tricks & Traps
Presented at the Puget Sound MapInfo User Group May 6, 2002
John Schlosser, Schlosser Geographic Systems, Inc. (SGSI)

 

Overview

  • Workspaces(*.wor's) are extremely useful.  Everyone should use them.
  • All of us have experienced the quirks of "wor's".
  • Purpose of this session is to learn to: 
    -- Take advantage of WOR features;
    -- Avoid and workaround WOR quirks;
    -- Use wor's as a springboard to MapBasic (time permitting).

What's a workspace (WOR)?

  • A text file containing the MapInfo commands needed to re-create a MapInfo session. 
  • Commands in workspace files (WORs) open MapInfo tables; create and position the necessary Map, Browser and other windows; define layer style and thematic settings; plus much more.  
  • A WOR is a MapInfo script or simple program.
  • Wor's are made by MapInfo automatically via the menu option "File > Save Workspace..."
  • You can view or edit any WOR using Word or Notepad.   Usually you won't edit a WOR, although a programmer might.
  • Here's an excerpt from a simple WOR:

-- Begin excerpt from Workspace file --

!Workspace
!Version 300
!Charset WindowsLatin1
Open Table "g:\mapdata\wacity" As WACITY
  Interactive
Open Table "g:\mapdata\wahwy" As WAHWY
  Interactive
Open Table "WAZip98d" As WAZip98d
Set Window MapBasic
Position (0.125,5.59375) Units "in"
Width 10.3333 Units "in" Height 1.375 Units "in"

-- End excerpt from Workspace file --

 

What a workspace is *not*?

  • Wor's don't hold map layer or table data.  It holds pointers or references to data.

Special WOR names:

  • MapInfo.WOR:  Can re-create your session as of the time you last exited MapInfo.
  • Startup.WOR:  Is run automatically when you start MapInfo.  Usually contains little or nothing.

WOR tricks & uses

WOR + revised data = Instant new map

Monthly "status" maps:  e.g., when only the data values change.  Remember that a WOR store file *references* or *pointers*, not the data.  So change the data values and see a revised map immediately by simply opening the original WOR.

Wor's as templates

There is value in using consistent map layout styles for a consistent organizational map "look and feel".  Also, your maps may all need a few identical elements:  e.g. a map footnote or disclaimer, or a logo.
How to: 
-- Create a simple Layout, with minimal files open;
-- Use "File > Save Workspace ..." to save, e.g., Map_8x11_Portrait.WOR.
-- When starting your next map project, load this template workspace first:  e.g., "File > Open Workspace> Map_8x11_Portrait.WOR.
-- See also "Startup.WOR".

       TemplateWorkspace.jpg (17061 bytes)

WORs as documentation for your project

After completing a map project, consider saving and archiving a workspace that defines the final deliverable:  e.g., "PopulationDensity_Final_050602.WOR".  Some users print a final map, then store the printed map + a diskette with the WOR, as documentation of the file names & settings used for the project. 

WORs as a safety net for work-in-progress:

Every map project involves series of incremental changes and adjustments.  Even if the underlying map layers are not being edited, your map layout and other changes are at risk if you've not saved a workspace.
Suggestion:  Save a new or revised workspace every 1/2 hour or so.  E.g., JS050602a.WOR, then JS050602b.WOR, ...


WOR traps & quirks

Error:   "Table [table name] is already open" when opening a WOR.  Workspace fails to open completely.

Why it happens:

The workspace is executing a command to "Open" a Table, but the table is already open.  This generates the error in MapInfo Pro 5.5 and earlier only.. 

Suggestions:

Use "File > Close All ..." before "File > Open Workspace .."

Error:  "Variable or field [column name] not defined" when opening a WOR.  Workspace fails to open completely.

Why it happens:

After the workspace file was made, someone renamed or deleted a column which is defined in the workspace as the source of a map label. Even if labels are not "turned on", the workspace defines the column from which labels will be drawn.  The workspace will "burp" if it doesn't find that column anymore.

Suggestions:

Edit the workspace with WordPad or a text editor. Search for the column name reported in the error message. Replace it with a valid column name. If unsure of the correct column name, replace the invalid column name with "Col1" or similar. This will substitute the first column ("Col1") for the invalid column name.


Message:  "Please locate [table name]" when opening a WOR.   You are asked to browse your file system to select the table interactively.

Why it happens:

  • After the workspace was made, a MapInfo table referenced in the workspace was moved to a different directory or renamed. OR
  • A table are referenced in the workspace does not have a full drive letter/path along with the table name. This is normal, if the table is in the default directory when the workspace is Saved. When Opening a workspace, MapInfo tries to find this table in your current default directory. Your current default directory is different that the default directory when your workspace was Saved. OR
  • Is the MapInfo table on a network drive? If so, your workstation computer may use different drive letters than the workstation computer that made the workspace.

Suggestions:

  • If you want to rename map tables, use "Table > Maintenance > Rename Table..." from within MapInfo.   Then re-save your Workspace. 
  • Beg your network administrator to make sure all workstations on the network use the same drive letters for network data drives.
  • Make several empty "dummy" or "substitute" tables (e.g., "substitute1.tab", "substitute2.tab"...). When the workspace asks you to interactively find a needed table, point to one of these substitute tables if you cannot find the real one. By doing this, you may be able to open your Workspace file more completely. This technique is particularly useful if the table in question is referenced in the workspace but is not a critical one.  [Special thanks to Tom Curley.]
  • Before making a workspace file that will be used by others, put all referenced tables in a single directory on a single drive.    This results is file name reference in the WOR that do *not* have a drive/path.
    To double-check, open the Workspace file manually with with NotePad or Word and verify that it does not include explicit drive and directory references.

Error:  "Unable to open [table name].  
Error:  "[workspace file] was not completely opened." when opening a WOR.   

Why it happens:

  • After the workspace was made, but before you tried to "Open" it, a table was moved or renamed. OR
  • A table are referenced in the workspace does not have a full drive letter/path along with the table name. This is normal, if the table is in the default directory when the workspace is Saved. When Opening a workspace, MapInfo tries to find this table in your current default directory. Your current default directory is different that the default directory when your workspace was Saved. OR
  • Is the MapInfo table on a network drive? If so, your workstation computer may use different drive letters than the workstation computer that made the workspace.

Suggestions:

  • Be cautious about renaming MapInfo tables or moving files into new directories.  You can easily make workspaces unusable.
  • MapInfo Pro, as of Rev. 6, keeps a list of directories to search if it doesn't find tables where it expects.  Consider adding new entries to this list:  "Options > Preferences > Directories..."

"Many of my labels are all jumbled: i.e., are in the wrong place on the map!"   

Why it can happen:

  • When you move text labels, or change their font etc, the changes are stored in the workspace.
  • These "custom labels" are identified by MapInfo by the literal object (row) number when you save the WOR (see below):

-- Begin excerpt from Workspace file --

Layer 3
Display Graphic
Label Line None Position Center Font

  ("Arial",1,9,0,16777215) Pen (1,2,0)
  With COL2
  Object 639 Font ("Arial",3,12,0,16777215)
   Anchor (263142.80199172586,3317229.7800705861)
  Object 612 Anchor
   (260352.13351478303,3318220.0172720817)

-- End excerpt from Workspace file --

  • Let's say you delete a few rows, then use "Table > Maintenance > Pack" to eliminate the grey-ed out rows.  In so doing, you've changed the numbering of the objects.  What was the 639th object, for example, may now be the 650th object.

Suggestions:

  • Be very cautious about Pack-ing tables referenced in multiple workspaces! 
  • Be cautious about relying on Custom text Labels in general.  See separate SGSI white paper about "Labels: Tricks, Tips & Traps"
  • If only one workspace is involved, and you must Pack the table, back up your table!  Then:
    -- First, open the Workspace;
    -- Second, pack the Table;
    -- Third, re-save your Workspace;
    -- Fourth, test the Workspace paying particular attention to the text labels.
  • Send email to MapInfo Pro's Product Manager, urging them to "find another way."  [moshe_binyamin@mapinfo.com]

My workspace does/does_not reconstruct my queries:

You can define whether or not to save query definitions in workspaces via Options > Preferences > Startup ...

     SaveQueriesInWorkspaces_65.jpg (20966 bytes)

Note:  Sometimes, when a workspace seems to take a very long time to open, it is because you have a query running.  Remember that the data itself is *not* in the WOR, so the WOR will execute the query on-the-fly.  With table having lots of records, this can take a while.

 

Moving lots of WORs to new systems, drives, or folders:

The following are ideas and, with the exception of "Workspace Archiver", have not been reviewed or evaluated by SGSI.   User/buyer beware.


Getting Technical with WORs:

For discussion, time permitting:

  • Editing workspace files.
  • Workspaces vs. MapBasic programming.
  • Saving workspaces from within MapBasic.

Frequently asked questions (FAQs):

To be added based on User Group discussion...







SGSI Product support:
> http://www.sgsisupport.com/
NW MapInfo User Group
> http://www.mapinfouser.com/

Terms of use | Trademarks & copyrights | SGSI Home | Top of page
Email | Map to Seattle office (pdf) http://www.sgsi.com/
Schlosser Geographic Systems, Inc. (SGSI)
Rev 2002, Beta, 03/01/02

Seattle, WA: 206-224-0800
Anchorage, AK: 907-746-6867
Honolulu, HI: 808-585-1100
Portland, OR: 503-224-0400