Opened 15 years ago

Closed 15 years ago

#3160 closed defect (fixed)

Label placement using ANGLE AUTO are not always positioned correctly

Reported by: aboudreault Owned by: aboudreault
Priority: normal Milestone: 5.6 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc: tbonfort, dmorissette, sdlime

Description

As reported by tbonfort, using ANGLE AUTO, the label is positioned in the middle of the line. That can produce bad result for some cases (if the lines contains more than one segment).
Solution: If only 1 label can be placed on the line, the label should be positioned in the middle of the bigger segment (as the old behavior).

Attachments (6)

agg_entity_encoded_follow_text-5.4.png (34.2 KB ) - added by aboudreault 15 years ago.
agg_entity_encoded_follow_text-5.6.png (34.5 KB ) - added by aboudreault 15 years ago.
labelpoint-5.4.png (3.8 KB ) - added by aboudreault 15 years ago.
labelpoint-5.6.png (3.8 KB ) - added by aboudreault 15 years ago.
agg_entity_encoded_follow_text-with-fix-5.6.png (38.7 KB ) - added by aboudreault 15 years ago.
labelpoint-with-fix-5.6.png (3.7 KB ) - added by aboudreault 15 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by aboudreault, 15 years ago

Cc: dmorissette added

The only "problem" I see is: if we have a line of length 200 (with 2 segments, a point at 0, 100 and 200) and repeatdistance disabled, the label will be placed at position 50. But I think we haven't the choice.

by aboudreault, 15 years ago

by aboudreault, 15 years ago

comment:2 by aboudreault, 15 years ago

To illustrate the problem, I've attached an image of MS 5.4 and one with 5.6-dev. That change has been made during RFC 55 implementation, and there was, of course, a few benefits. I'm currently making another mapfile to show those benefits.

comment:3 by dmorissette, 15 years ago

Cc: sdlime added

by aboudreault, 15 years ago

Attachment: labelpoint-5.4.png added

by aboudreault, 15 years ago

Attachment: labelpoint-5.6.png added

comment:4 by aboudreault, 15 years ago

I've attached 2 images: the first one is the old behavior (mapserver 5.4) with a line with 2 segments, and the second same image with new behavior (mapserver 5.6). We can see that the change has its benefits.

As discussed with dmorissette, a solution could be to add a flag to that function: center_on_longest_segment, which will force the centering on the longest segment if repeatdistance is disabled or that there is only 1 label that can be placed along the line. That flag would be set to true in case of text placement... and false in case of symbol placement.

comment:5 by aboudreault, 15 years ago

In fact, it would be set to true IF the angle is set to AUTO... otherwise false.

by aboudreault, 15 years ago

Attachment: labelpoint-with-fix-5.6.png added

comment:6 by aboudreault, 15 years ago

Finally, Here's 2 images that show the behavior with that fix. Any thought about the proposed solution?

comment:7 by dmorissette, 15 years ago

To sum it up the proposed algorithm is:

  • with ANGLE FOLLOW, nothing changes: the label is always positioned at the center of the overall polyline
  • with ANGLE AUTO, we come back to 5.4 behavior: the label is positioned a the center of the longest segment of the polyline and follows the angle of that segment
  • with ANGLE [constant], the behavior changes with respect to 5.4: we position the label at the center of the overall polyline, giving better results for highway shields or other labels that do not need to be aligned with the shape of the polyline

comment:8 by aboudreault, 15 years ago

Resolution: fixed
Status: newclosed

Fixed and committed in r9416. (Sorry for the commit message, my bad)

Note: See TracTickets for help on using tickets.