Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label frame offset with leader line #5326

Closed
wants to merge 3 commits into from
Closed

Label frame offset with leader line #5326

wants to merge 3 commits into from

Conversation

tbonfort
Copy link
Member

@tbonfort tbonfort commented Sep 20, 2016

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
Copy link
Member

tbonfort commented Sep 19, 2016

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

@stephendoc
Copy link
Author

stephendoc commented Sep 19, 2016

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
Copy link
Member

tbonfort commented Sep 20, 2016

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
Copy link
Member

tbonfort commented Sep 20, 2016

applied to branch-7-0

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

jmckenna commented Sep 20, 2016

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
Copy link
Member

jmckenna commented Sep 20, 2016

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
Copy link
Member

jmckenna commented Sep 20, 2016

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

tbonfort added a commit that referenced this pull request Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants