Label frame offset with leader line #5326

Closed
wants to merge 3 commits into
from

Projects

None yet

3 participants

@stephendoc

When using the LEADER for point labels, the GEOMTRANSFORM 'labelpoly' frame around the label gets an offset both vertically and horizontally. See the image below where the bottom-left label has a leader, but the green frame is moved a few pixels down and to the right. The label which rendered without a LEADER has the correct frame around it.

labeloffset

Here is a section of my mapfile for the relevant layer:

LABEL 
    WRAP "!"
    ALIGN center
    TEXT ('[name]' + "!D116.7 " + '[ident]')
    MAXSCALEDENOM 2600064
    POSITION auto
    PARTIALS false
    SIZE 8 
    COLOR 100 150 100
    TYPE truetype 
    FONT vera
    FORCE false 
    STYLE
            GEOMTRANSFORM 'labelpoly'
            OFFSET 2 2
            COLOR 150 200 150
            OUTLINECOLOR 150 200 150
            WIDTH 1
            OPACITY 100
    END
    STYLE
            GEOMTRANSFORM 'labelpoly'
            COLOR 255 255 255
            OUTLINECOLOR 150 200 150
            WIDTH 1
            OPACITY 95
    END
END
LEADER
    GRIDSTEP 40
    MAXDISTANCE 1000
    STYLE
            COLOR 150 200 150
            WIDTH 2
    END
END

Thanks,
Stephen

@tbonfort
Member

Please provide a complete testcase (mapfile+data+request) that reproduces this.

@stephendoc

Hi Thomas,

Here it is, data and mapfile:
ticket.zip

I call it with:

mapserv.fcgi?MAP=/path/to/newtest.map&SERVICE=WMS&VERSION=1.3.0&WIDTH=800&HEIGHT=800&FORMAT=image/png&REQUEST=GetMap&LAYERS=cities&STYLES=&CRS=EPSG:3857&BBOX=-179,-79,179.122902,79

It produces an image like below, see Brussels, Denver and Oslo for example:

mapserv fcgi

I have noticed a workaround, and that is to not use "POSITION auto" for the LABEL. If I instead use "POSITION lc", the result is:

mapserv fcgi 2png

And that looks correct with respect to the label frame. Now, I just need to find a way to make the leader and label look connected, without using "POSITION cc", since that won't really look good for labels without leader as they would hide the feature. :)

Regards,

Stephen

tbonfort added some commits Sep 20, 2016
@tbonfort tbonfort Fix position of labelpoly on offsetted labels (#5326)
7fa7c11
@tbonfort tbonfort Fix position of rendered offsetted labelpnt marker (#5326)
fac9b36
@tbonfort
Member

I've attached a fix for this. There was also a bug on the offseted label computations, as in your example the red symbol should also be offseted instead of remaining on the original position.
If you don't need a symbol attached to that label you should be OK.
Support for offsetting only part of a label (i.e. in your example the text but not the red dot) is not implemented, you can contact me if that is something you want to fund. The use case implemented is to offset a whole complex symbol, e.g. a meteo forecast icon.

@tbonfort tbonfort Fix segfault on offsetted labels with multiple styles (#5326)
b8826df
@tbonfort
Member

applied to branch-7-0

@tbonfort tbonfort closed this Sep 20, 2016
@jmckenna
Member

Tested with branch-7-0. Here are the results, using that sample mapfile (which I see was initially written by me, ha, small world):

MapServer 7.01:

before

MapServer-branch-7-0

after

@jmckenna
Member

Yikes, I prefer the old MapServer 7.0.1 results. I find the branch-7-0 resulting map image confusing in terms of leader lines.

@jmckenna
Member
jmckenna commented Sep 20, 2016 edited

Ah ok it is the labelframe, which does display properly in the branch-7-0 image. sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment