I wrote this a couple of years ago, after attending the Map basic course. It opens a
reference table(DOGwellsymbols.tab) of font codes and matches status codes to get the
right symbol for the status of oil and gas wells into a Thematic Map. I figure that
you all are talking about doing something similar. The limitation is 255 symbols,
which in my case, hasn't been an issue (yet). I am not quite sure how or if I could
convert this operation to a function or if the function would be noticeably quicker.
Definition Table
Type NATIVE Charset "WindowsLatin1"
Fields 4
Status_cod Char (4) Index 1 ;
Symbol Smallint ;
Font_name Char (35) ;
Description Char (70) ;
sub symbolthem
Dim win_id, i_symbol, i_value_count As Integer
dim s_value, s_code, s_font, s_shade, s_table as string
dim a_font, a_code as alias
'** Make sure the user didn't click in a Layout window.
win_id = FrontWindow()
If WindowInfo(win_id, WIN_INFO_TYPE) <> WIN_MAPPER Then
Note "This tool may only be used on a Map window."
Exit Sub
End If
open table "W:\datadbf\wellsymbols\DOGwellsymbols.tab" interactive
a_font="dogwellsymbols.font_name"
a_code="dogwellsymbols.status_cod"
fetch first from DOGwellsymbols
i_symbol=dogwellsymbols.symbol
s_code=chr$(34)+a_code+chr$(34)
s_font=chr$(34)+a_font+chr$(34)
i_value_count=1
s_value=s_code+" symbol ("+i_symbol+" , 0, 12, "+s_font+",0 ,0 )"
fetch next from DOGwellsymbols
do while not EOT(DOGwellsymbols)
i_symbol=dogwellsymbols.symbol
s_code=chr$(34)+a_code+chr$(34)
s_font=chr$(34)+a_font+chr$(34)
if s_code=chr$(34)+chr$(34)then goto skip
end if
i_value_count=i_value_count+1
s_value=s_value+","+chr$(13)+s_code+" symbol ("+i_symbol+" , 0, 12, "+s_font+",0 ,0 )"
skip:
fetch next from DOGwellsymbols
loop
if i_value_count > 255 then
note "Your have exceeded the number of symbols for a Thematic Map."
end if
close table "DOGwellsymbols"
call file_list
s_table=tableinfo(i_read,tab_info_name)
s_shade="Shade "+s_table+" with STATUS_COD values "+s_value
run command s_shade
end sub
-----Original Message-----
From: Peter Horsb�ll M�ller [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 11:56 AM
To: Canfield, Andrew; Bill Thoen
Cc: MapInfo-L
Subject: RE: MI-L Set multiple object symbols quickly?
And to get really going use this syntax:
Set Table MYTABLE FastEdit On Undo Off
UPDATE MYTABLE SET obj = MyFunction( Type )
Commit Table MYTABLE
Set Table MYTABLE FastEdit Off Undo On
This prevents MapInfo from writing temporary transaction files.
Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
Tel +45 6311 4900
Direct +45 6311 4908
Mob +45 5156 1045
Fax +45 6311 4949
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
-----Original Message-----
From: Canfield, Andrew [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 6:05 PM
To: 'Bill Thoen'
Cc: MapInfo-L
Subject: RE: MI-L Set multiple object symbols quickly?
Thanks Bill! That is exactly what I was looking for.
-----Original Message-----
From: Bill Thoen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 7:33 AM
To: Canfield, Andrew
Cc: MapInfo-L
Subject: Re: MI-L Set multiple object symbols quickly?
"Canfield, Andrew" wrote:
>
> Is there a quick way to set the symbol for a large selection of
> objects using MapBasic?
Write a function in MB that returns an object when passed your Type variable and use
it in the UPDATE statement like so:
UPDATE MyTable SET obj = MyFunction( Type )
Note that table columns like 'Type' must be passed ByVal.
This trick works MUCH faster than a Do Loop!
>
> Here is my problem: I have a series of tables, in each of
> these tables I have multiple point object groups, they are grouped by
> a field called "type" in my MapBasic I select all from that table
> where the "type" like "x".
> Currently I loop through the selection and set each row's
> object symbol to what I want it to be. This is horrendously slow
> considering
there
> can be 100,000+ objects for each selection I run on the table and
> there
can
> be 15 to 20 different "type"'s within the table.
> So I'm wondering if there is a MapBasic statement where I
> could do something along the lines of "Set Symbol =
> MakeSymbol(1,1,255) Where
(Select
> * From MyTable Where Type Like X)"
>
> A sort of sub query to set the symbol on a mass selection? Does
> something like this exist or is there only one way to do this?
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> Message number: 11983
--
- Bill Thoen
------------------------------------------------------------
GISnet, 1401 Walnut St., Suite C, Boulder, CO 80302
tel: 303-786-9961, fax: 303-443-4856
http://www.gisnet.com/
------------------------------------------------------------
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11987
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11988
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11989