[mapserver-users] LABEL POSITION - Numeric or String from adatabase

Donald Kerr donald.kerr at dkerr.co.uk
Sun Nov 21 10:20:15 EST 2010


This works (see code below) but would require 30 x 9 classes where,
previously there were 30.

LABELITEM removed
TEXT added
EXPRESSION changed - added anchorpositiontxt - I would need 9 x classes for
each feature code (30).

I am guessing that there must be a way to achieve this without having to
move from 30 to 270 classes.

=======================================================
#LABELITEM textstring

CLASS
	# Building
	EXPRESSION (([featurecode] = 10020) And
("[anchorpositiontxt]"="cc"))
	TEXT ([textstring])
	LABEL
		TYPE truetype
		FONT arial
		SIZE [height]
		POSITION cc
		COLOR [oscolor]
		ANTIALIAS TRUE
		ANGLE [orientation]
		FORCE TRUE
	END # LABEL
END # CLASS
=======================================================

Regards,

Donald


-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Donald Kerr
Sent: 21 November 2010 14:34
To: 'tommaso'
Cc: mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] LABEL POSITION - Numeric or String from
adatabase


Tommaso,

There are already 30 classes, each with their own attributes, some of which
also come from the database (see example below). I don't think I can also
use CLASSITEM and two EXPRESSIONs. 

=======================================================
LABELITEM textstring

CLASS
	# Building
	EXPRESSION ([featurecode] = 10020)
	LABEL
		TYPE truetype
		FONT arial
		SIZE [height]
		POSITION cc
		#POSITION [AnchorPositionTxt]
		COLOR [oscolor]
		ANTIALIAS TRUE
		ANGLE [orientation]
		FORCE TRUE
	END # LABEL
END # CLASS =======================================================

Regards,

Donald


-----Original Message-----
From: tommaso [mailto:tommasodb at googlemail.com] 
Sent: 21 November 2010 13:59
To: Donald Kerr
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] LABEL POSITION - Numeric or String from a
database


Hallo Donald,

you can define a layer with so many classes how are your possible label
positions and filter each class with the value of the attribute
"AnchorPositionTxt"

i.e:

LAYER

  NAME "layer"
  ...
  ...
  CLASSITEM "AnchorPositionTxt"
  LABELITEM "name"
  CLASS
    EXPRESSION "ul"
    LABEL
        POSITION ul
        ...
    END
  END
  CLASS
    EXPRESSION "lr"
    LABEL
        POSITION lr
        ...
    END
  END
END

Cheers,
Tommaso

On Sun, 2010-11-21 at 10:21 +0000, Donald Kerr wrote: 
Hi List,

I am trying to change a LABEL's POSITION by using an integer without
success.

As far as I can see, the LABEL's POSITION can be any one of the following
constants: enum MS_POSITIONS_ENUM {MS_UL=101, MS_LR, MS_UR, MS_LL, MS_CR,
MS_CL, MS_UC, MS_LC, MS_CC, MS_AUTO, MS_XY , MS_FOLLOW};

I was assuming that I can replace UL with "101" i.e. instead of "POSITION
UL" I use "POSITION 101" but that doesn't work.

I have also tried replacing "POSITION UL" with text values from a database
i.e. "POSITION [AnchorPositionTxt]" where "AnchorPositionTxt" is a string
'UL' but, again, that doesn't work.

Is there a way to set this value dynamically from the database with either
numbers or strings ('UL', LR, etc...)?

Many thanks.

Regards,

Donald Kerr

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list