Opened 14 years ago
Closed 13 years ago
#3523 closed defect (fixed)
RFC-60: Add ability to skip ANGLE FOLLOW labels with too much character overlap
Reported by: | dmorissette | Owned by: | jmckenna |
---|---|---|---|
Priority: | normal | Milestone: | 6.0 release |
Component: | Documentation - MapServer | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | jmckenna, sdlime, tbonfort, woodbri |
Description
As part of the FOSS4G 2010 Benchmarking exercise, one of the layers to render was contours with labels, and we've seen that MapServer did a poor job of labeling some contours with sharp curves using ANGLE FOLLOW, resulting in overlapping characters and unreadable labels.
OTOH, we found that GeoServer for instance didn't have this type of problematic labels because it simply detected the overlapping chars and skipped those labels, leaving room for other/better labels to fall around the same spot... leading to a better looking map.
This ticket is about implementing a similar mechanism to detect overlapping characters in ANGLE FOLLOW chars and skipping those labels.
Note that ticket #2221 started discussing this option as part of a wider discussion of curved label problems, but since #2221 aims to address a different issue using b-spline to smooth the lines an get less erratic char positioning along valid curved labels, I decided that the ability to skip invalid labels with overlapping chars along very sharp curves should get its own ticket (and eventually RFC).
Attachments (6)
Change History (23)
by , 14 years ago
Attachment: | mapserver-wms.png added |
---|
comment:1 by , 14 years ago
Here is the WMS request used for mapserver-wms.png for future reference (a similar request was used by GeoServer):
comment:2 by , 14 years ago
This is a good description of the current issue. Do we need an RFC for rejecting problem labels? (just asking, I am not questioning the process...I'll help out either way)
comment:3 by , 14 years ago
Well, yes, I suppose... since we plan to add a new mapfile keyword (new feature), MAXOVERLAPANGLE, which allows the user to configure the angle used in the label placement to bails labels.
comment:4 by , 14 years ago
What's the new parameter specify? Why wouldn't we just want to drop labels with overlap unconditionally? I guess I don't know what there is to tune from a users perspective...
Steve
comment:5 by , 14 years ago
Because dropping labels means...err... dropping labels, and some users may prefer overlapping labels to no label at all... that was our thinking anyway. If we introduce this feature unconditionally in 6.0, I can already hear the comments on the users and dev list that we caused a regression.
What we were thinking was to leave the default behavior as it is now (i.e. do not reject anything), and add a MAXOVERLAPANGLE (better keyword name welcome) whose value is the max angle between two consecutive chars before the label is dropped. In Alan's tests, he found that 22.5 degrees seems like a good default value, so we would recommend in the docs that users use 22.5 as default to get started when they enable the feature, and tune it up or down depending on the type of data and their tolerance to bad labels.
comment:6 by , 14 years ago
Exact. But in a few other tests, I had to increase that angle value to get the result I wanted. So, there are no absolute values for this feature.
comment:7 by , 14 years ago
My 2 cents is that nobody *wants* crappy labels so why give them the option to keep them. I think users tolerate them now and would be happy if they weren't visible. Plus, I hate adding keywords... ;-)
How is overlap being determined? Just by angle or are you testing character bboxes?
Steve
comment:8 by , 14 years ago
I understand that nobody wants crappy labels.... but mapserver is not able to determine which one is a crappy label. The overlapping is determined only with that angle value..... since we couldn't do it using the bboxes. The bboxes just always overlap.This will be mentionned in the RFC with an image as example.
comment:9 by , 14 years ago
How'bout we enable this by default with a default value of 22.5 degrees, and add a keyword (sorry Steve) for those who want to disable or tweak it?
comment:10 by , 14 years ago
In my opinion... it's not a good idea. Since it's not an absolute value... this could just *really* fails on some maps. This is not a *brillant* test. Why would we force the user to get something worst (in a few cases), with less labels. Let the user with what he already has... which was probably ok if he still uses mapserver :P... and just give them the possibility to get something better.
by , 14 years ago
Attachment: | mapserver-label-with-fix.png added |
---|
mapserver-label-with-fix.png - MapServer map in which labels with char overlap > 22.5 degrees are skipped
follow-up: 12 comment:11 by , 14 years ago
I guess I'd prefer to have this discussion in the context of the RFC. With vast data sets and display scales being so common I think it's going to be hard to control in practice.
I wonder if AGG's curved label support could somehow be leveraged now that it's a required component. Some of the splined text support demos are spectacular. Visit http://www.antigrain.com/demo/index.html and look at the trans curve examples.
Steve
by , 14 years ago
Attachment: | mapserver-collisions-repeatdistance-400-min-100.png added |
---|
Contour map using MAXOVERLAPANGLE 22.5, REPEATDISTANCE 400 and MINDISTANCE 100
comment:12 by , 14 years ago
Replying to sdlime:
I wonder if AGG's curved label support could somehow be leveraged now that it's a required component. Some of the splined text support demos are spectacular. Visit http://www.antigrain.com/demo/index.html and look at the trans curve examples.
Can't really be used as it needs a smooth curve to obtain correct results (see the distortion in characters on the sharp turns on the example image). In the mapserver case where we don't have curves but a succession of line segments, the output is illegible.
by , 14 years ago
Attachment: | mapserver-label-boxes.png added |
---|
BBoxes of individual chars in contour labels
by , 14 years ago
Attachment: | maxoverlapangle-2.png added |
---|
Here is another example showing MAXOVERLAPANGLE 22.5 on a street map
comment:14 by , 14 years ago
Component: | MapServer C Library → MapServer Documentation |
---|---|
Owner: | changed from | to
Fixed and committed in r10525. Changing component to documentation.
comment:15 by , 13 years ago
comment:16 by , 13 years ago
The implementation is done. The ticket has been reassigned and is left open for docs. (Or should we create another ticket for docs, Jeff?)
comment:17 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
As far as I can see, this has been documented in mapfile-> label. It does not seem to have been documented for mapscript, but a lot is missing there anyway. I close this ticket, and have created a separate documentation ticket (#3984) for mapscript.
Contour labels produced by MapServer 5.6