Opened 13 years ago

Last modified 13 years ago

#3612 assigned enhancement

Allow LABEL POSITION, MINSIZE and MAXSIZE to be Set Dynamically

Reported by: DonaldKerr Owned by: sdlime
Priority: normal Milestone: 6.0 release
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc:

Description

Allow LABEL POSITION, MINSIZE and MAXSIZE to be set dynamically e.g. by determining the position from a database record.

I have the following CLASS definition in a map file. In order to set LABEL POSITIONs dynamically, I have to have 9 similar classes to cover the 9 labelling positions ll,cl,ul, etc., as I cannot set the value directly from the database.


LABELITEM textstring

CLASS

EXPRESSION (([featurecode] = 10020) And ("[anchorpositiontxt]"="ll")) LABEL

TYPE truetype FONT [font] SIZE [height] MAXSIZE 21 MINSIZE 4 POSITION ll #COLOR 0 0 0 COLOR [oscolor] ANTIALIAS TRUE ANGLE [orientation] FORCE TRUE

END # LABEL

END # CLASS


With 30 different classes, each being repeated 9 times, it would be much easier if I could set the POSITION dynamically as with the following desired CLASS definition:


LABELITEM textstring

CLASS

EXPRESSION ([featurecode] = 10020) LABEL

TYPE truetype FONT [font] SIZE [height] MAXSIZE 21 MINSIZE 4 POSITION [anchorpositiontxt] #COLOR 0 0 0 COLOR [oscolor] ANTIALIAS TRUE ANGLE [orientation] FORCE TRUE

END # LABEL

END # CLASS


Same goes for MINHEIGHT and MAXHEIGHT. If these could be set along the lines of [height]*3 or [height]/3 or even just another database field, it would allow for more dynamic map configuration and less map file hard-coding.

Attachments (1)

patch_position_rev10769 (5.5 KB ) - added by erigus 13 years ago.
Position attribute binding

Download all attachments as: .zip

Change History (5)

by erigus, 13 years ago

Attachment: patch_position_rev10769 added

Position attribute binding

comment:1 by erigus, 13 years ago

Attribute binding for label position would be very useful for me too. Attaching a patch I've used previously.

comment:2 by sdlime, 13 years ago

Milestone: 6.0 release
Status: newassigned

comment:3 by sdlime, 13 years ago

Added label position binding to trunk in r11063. The minsize/maxsize stuff doesn't seem as valuable. Maybe in a 6.x release when there's a bit more time.

Steve

comment:4 by DonaldKerr, 13 years ago

Excellent work, thank you. Granted, minsize/maxsize binding may not be as useful but it would certainly benefit my purposes. If it's relatively easy to do the I'd certainly like to see it sooner rather than later. Thanks for your work again which is greatly appreciated.

Donald

Note: See TracTickets for help on using tickets.