Hi Paul,
I am creating a thematic map tool for a client through Mapbasic. They
have some point data (defects in a road i.e. potholes) that reside
within roadsegments. They wanted a colour gradient to count the points
within each road segment so they could visually see where their trouble
spots are. The colour gradient worked well but often it wasn't obvious
how many defects were in each segment by just viewing the legend so I
wanted to label the segments with their defect count. Obviously some
segments didn't have defects which resulted in a lot of 0's all over the
map. Peter and Dougs label expression solved this i.e.
Left$(Str$(Count), Int(Count>0) * Len(Str$(Count))). Below is the code I
used to compile the sub routine. Any suggestions on improvements are
more than welcome.
Sub DefectThematic
OnError goto ErrorHandle
Add Column "RoadSegments" (Count)From MapInfo_DefectsOpen Set To
Count(*) Where within
commit table RoadSegments
shade window FrontWindow() RoadSegments with COL15 ranges apply all use
all Brush (1,16765136,16777215) 0: 0 Brush (1,16765136,16777215) Pen
(1,2,0) ,1: 2 Brush (2,16752800,16777215) Pen (1,2,0) ,2: 3 Brush
(2,16740464,16777215) Pen (1,2,0) ,3: 4 Brush (2,16724016,16777215) Pen
(1,2,0) ,4: 100 Brush (2,16711680,16777215) Pen (1,2,0) default Brush
(2,16777215,16777215) Pen (1,2,0)
Set Map Layer RoadSegments Label With Left$(Str$(Count), Int(Count>0) *
Len(Str$(Count))) Parallel Off Auto On Offset 0
Set Map Layer RoadSegments Label Font ("Arial",257,11,16777215,0)
ErrorHandle:
Call Main
end sub
-----Original Message-----
From: Paul Smith [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 13 September 2005 1:20 PM
To: Ellingham Morgan
Subject: RE: MI-L MI Label Expression Help
Hi Mogan,
I am interested in the solution. Always good practice to sum up your
findings and let the list know.
Thanks
Paul
-----Original Message-----
From: Ellingham Morgan [mailto:[EMAIL PROTECTED]
Sent: Monday, 12 September 2005 4:38 PM
To: [email protected]
Subject: RE: MI-L MI Label Expression Help
Worked a treat guys, thanks both Doug and Peter for your help. The roads
in
the City of Melbourne will be better off because of you!
Regards...
Morgan Ellingham
Citywide Service Solutions
GIS Technical Officer
Level 1, 150 Jolimont Rd, East Melbourne
Ph: (03) 9261 5065
Mob: 0419 145 666
Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17842