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

Improve default label placement for "POSITION auto" #4249

Closed
mapserver-bot opened this issue Apr 4, 2012 · 5 comments
Closed

Improve default label placement for "POSITION auto" #4249

mapserver-bot opened this issue Apr 4, 2012 · 5 comments

Comments

@mapserver-bot
Copy link

Reporter: olt
Date: 2012/03/15 - 17:49
Trac URL: http://trac.osgeo.org/mapserver/ticket/4249
With POSITION auto, MapServer tries to place each label at different positions until if finds enough free space. It starts with UL (upper/left) even if there is space for UC (upper/center) which would look much better IMO.

I changed the order to the following and the results are much better, again IMO.
Line 2578 in mapdraw.c

positions[0]=MS_UC; positions[1]=MS_LC; positions[2]=MS_UR; positions[3]=MS_CR; positions[4]=MS_LR; positions[5]=MS_UL; positions[6]=MS_CL; positions[7]=MS_LL;

See attached images.

@mapserver-bot
Copy link
Author

Author: tbonfort
Date: 2012/03/15 - 18:00
duplicates #4242

@mapserver-bot
Copy link
Author

Author: olt
Date: 2012/03/15 - 18:26
Oh, my fault. I searched for "placement" and not "position" when I checked for similar tickets.

@mapserver-bot
Copy link
Author

@mapserver-bot
Copy link
Author

@havatv
Copy link

havatv commented Sep 23, 2012

Labelling points is very different from labelling lines and polygons, so we can not have a common sequence for polygons, lines and points. What I discuss here is the allocation of priorities for points.

The priorities should be set in accordance with cartographical literature and best practice.

  • In "Elements of Cartography" (Robinson, et.al., Wiley 1995), the following sequence is listed for point labelling:
    UR,UL,LR,LL,UC,LC.
    CR and CL are not included, but some more variations of upper placement are listed as priorities 7-9.
  • In "Thematic Cartography and Geographic Visualization", 2nd edition (Slocum, et. al., Pearson 2005), the following sequence is listed for point labelling (referring to Pinhas Yoeli, 1972, but modified to give preference to R (right side) placement - to make it more consistent with legends): UR,LR,UL,LL,UC,LC,CR,CL.
    CR and CL are placed last, because those positions can result in "unfavourable optical coincidence" (Imhof 1975) - the point symbol could be misinterpreted as a type character in the label.

The way I see it, it would be useful to change the behaviour of Mapserver auto labelling.

  1. UR must be given the highest priority.
  2. LL, UC, LC, CR and CL should be given lowest priority.
  3. Someone must decide the sequence for LR and UL (I don't have a preference).

According to the literature above, the two possible sequences are:

  • UR,LR,UL,LL,UC,LC,CR,CL
  • UR,UL,LR,LL,UC,LC,(CR,CL)

For refererence, these are the current Mapserver label placement AUTO priorities (6.0 and 5.6):

  • Polygon:
   positions[0]=MS_CC;
   positions[1]=MS_UC;
   positions[2]=MS_LC;
   positions[3]=MS_CL;
   positions[4]=MS_CR;
  • Line:
    positions[0]=MS_UC;
    positions[1]=MS_LC;
    positions[2]=MS_CC;
  • Point:
    positions[0]=MS_UL;
    positions[1]=MS_LR;
    positions[2]=MS_UR;
    positions[3]=MS_LL;
    positions[4]=MS_CR;
    positions[5]=MS_CL;
    positions[6]=MS_UC;
    positions[7]=MS_LC;

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

No branches or pull requests

4 participants