Grant Dickson wrote:
> 
> Hello all,
> 
> You know when you have created a map and you have to
> move about the labels so that you can see them all
> clearly? You save your workspace, and all the custom
> label positions have been saved. Then you have to
> delete a record from the table and pack it.
> When you open up your workspace again, the labels have
> all gone to pot because of the way the workspace
> stores the labelling attributes, (to row and not by
> object).
> Does anyone know of a tool that recreates those
> painstaking labelling exercises once you have packed
> your table? Or a packing tool that doesn't cause this
> problem in the first place?
> "Not packing a table" is not an answer I am looking
> for.
> 
> I usually just edit the workspace in excel or
> something, but I am getting bored of doing this.
> 
> Grant

Hi Grant, I had to do this once and as painful as it was I found a
halfway decent solution for the "I'm not afraid to modify my workspace"
MapInfo user...and it's not a short solution either...

So you have your original table, let's call it Original. Make a copy of
original and pack it, I'll call it Packed, and there are no labels or
anything, this can be done outside a workspace.

To both the tables I had to add five columns to contain rowid,
centroidx(), centroidy(), the number of nodes, and the area of the
object (if you have polylines, then use object length). These are some
of the 'unique object identifiers' which can be found on Mr. Paris' site
and since I knew I had unique objects this was all I needed to query.
Centroidx(), centroidy() and area can all be found in SQL, I think I
used a Mapbasic statement for the nodes but this column may not be as
critical as the others if you choose not to use it.

To the Original table add a column called NewRowID. Then using SQL
update this column with the Packed RowID value where centroids, nodes,
and area (or length) are similar. You can also add your label value
columns to this query to ensure you get the right label to the right
object if there are any identical ones.

Now you should have a couple of columns in your Original table that
contain Original rowids and Packed rowids. This was the easy part...

Go into your workspace and copy and paste all of your custom label
statements into Notepad, save the file and import it into Excel. There
will be some formatting issues at the end but the only info you
absolutely need to have in its own column are the Original rowids. You
may have to let Excel bring the text file in as space delimited so you
don't truncate the longer rowids.

Now you have to select the Excel Original rowid column and save just
that info as a new text file, and import it into MapInfo. What you have
now is a MI table with rowids of the objects in the Original table that
have labels.

Select the NewRowID column from the Original table where the Original
rowid is the same as the ones in the new file we brought in from Excel.
The number or records selected from the Original table should be the
same as the number or total records as the file from Excel.

Save the selected NewRowID column as a text file. This will contain all
the row/object ids from the Packed table that should be labelled. Import
this text file into Excel. You should see that the numbers will line up
closely with the Original rowids in Excel but they are different.
Replace the Original label rowids with the Packed rowids you just
imported. Now you have label statements pointing to the proper objects
for you Packed table.

But you're still not done...export the Excel spreadsheet as a text
document. Now you will see that Excel had added a whole bunch of "" to
the file which MapInfo won't appreciate. You will have to use Word to
replace and remove these - just be sure not to remove the required ones
around the label text!!! It's not easy but it can be done. You will need
to have a good understanding of the higher level search and replace
functions in Word. Copy the Notepad document to the clipboard.

Once you have your text file formatted properly, open your Packed
workspace in MapInfo and label a few objects, making sure to move the
labels around manually so the custom label info will show up in the
workspace. Open the workspace in NotePad or WordPad. Go down to the
place where you see your two or three custom labels. Highlight them all
and copy your other file on top of it. Save the workspace and when you
reopen it all the labels should be there, attached to the proper object.

This map seem like a lengthy process but it was about 10 times faster
than relabelling the 3000+ objects.

Good luck, I think you'll need it :)

Ron

Ron Halliday, Cartographer
Portolan Geomatics Inc.
http://members.home.net/portolan/
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to