Set Line Style in MapBasic Window

785 views
Skip to first unread message

Sarah

unread,
Oct 14, 2009, 5:31:57 AM10/14/09
to MapInfo-L
I am trying to set up a workspace which will run a series of commands
to open MapInfo tables, select certain fields, set hyperlinks and set
line/point/region styles and finally save the result as new MapInfo
tables. I am doing this by making changes in the Map window with the
MapBasic window open and copying and pasting the commands into a
workspace file.

This is all working nicely apart from being able to set line/point/
region styles. Can anyone advise me how to do this because when I
change the styles, no commands are displaying in the MapBasic window.

For a MapInfo table with only lines in it, I would like to select out
lines based upon criteria in a specified column and set different
colours for each criteria. I have made the line layer editable and
selected out the appropriate records using SQL Select. How can I now
display the statement which defines the colour that I choose?

Essentially what I am trying to do is create a thematic map but with
the colours hardcoded into the MapInfo table itself. I want this to
run automatically upon opening a workspace rather than the user having
to manually set the colours themselves.

Any help greatly appreciated

Thanks

Sarah

tastrax

unread,
Oct 14, 2009, 6:21:31 PM10/14/09
to MapInfo-L
Something like this should set the line style

' Set Style of pen to 2 point, B21 of grid, Red
Set Style LinePen MakePen (2,82,RED)


Andy Harfoot

unread,
Oct 15, 2009, 4:59:11 AM10/15/09
to mapi...@googlegroups.com
Hi Sarah,

A number of suggestions here, none of which are exactly what you are
looking for though :(

As far as I know, altering object styles permanently at a table level
isn't possible without using a MBX to help - the MB commands that alter
styles only work on one object at a time.
If you are wanting your users to open a workspace and permanently alter
the styles of a table, you also need to consider the possibility of
multiple users opening the workspace simultaneously which will likely
cause an error as multi user editing of tables is not permitted.

If you only want to alter the colours temporarily you could run your
queries and then add the query tables to a map window where you can
apply a style override to each.

If the styling is a one off - ie the results of the queries do not
change from one opening of the workspace to the next, you could generate
a thematic map to set up the styling and then use the Hard Code
Thematics tool (link below) to set the thematic styles as the default
object styles for the table.
http://www.directionsmag.com/files/index.php/view/675

Finally (but maybe obviously), if the results are likely to change but
could be represented by a thematic map, why not use one! You could do
this either by using a shade statement in your workspace, or by setting
a 'default theme' for the table in question (MI version 8.5+ I believe)
and enabling the option to load this automatically (Options >
Preferences > Map Window > Automatically Open Default Theme)

Andy
--
Andy Harfoot

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

Tel: +44 (0)23 8059 2719
Fax: +44 (0)23 8059 2849

www.geodata.soton.ac.uk

---------------------------------------
For further information about GeoData's
Training Courses, please visit:
www.gis-train.com
---------------------------------------


Reply all
Reply to author
Forward
0 new messages