Opened 18 years ago

Last modified 13 years ago

#1592 new enhancement

Improved Label Position Capabilities

Reported by: woodbri@… Owned by: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: unspecified
Severity: minor Keywords: tbonfort
Cc: tbonfort, woodbri@…

Description (last modified by sdlime)

We need to have improved control over label positioning. Currently OFFSETs are
only in image space. I and Bob Basques, may be others, would like to be able to
add house number range labels to road polylines. This could easily be done with
the features described below which also would faciliate numerous other label
capabilities like placing a directional marker at a given percentage along the line.

Requirements:

1. positional selection of label point at percentage (0.0-1.0) along a line
2. offsetX would always be to the left of the line relative to direction of line
3. offsetY would always be along the direction of travel
4. negative offsets would have the opposite sense
5. (0,0) is the label point, either defined as today or via the percentage above
6. the label point should be effected by POSITION so the label can be positioned
 above, below, on the line and justified right, left or center.
7. ANGLE AUTO with lines will align the label with the angle of the line at the
label point in the case of a polyline
8. For polygons, offsetX will be outside the polygon and -X will be inside the
polygon, while offsetY will be along the polygon boundary. This will allow
labeling polygons along their boundary without the label flipping to the outside
of the bounday. Not sure what to do with multiple parts.
9. For polygons, it might be nice to have a MAXDISTANCE that will allow multiple
labels to be generated along a boundary that are spaced at approximately
MAXDISTANCE apart.

Here is an example of adding address ranges to a road segment along with the
road name.

LAYER
  TYPE LINE
  STATUS DEFAULT
  DATA ...
  CLASS
    COLOR 0 0 0
    SYMBOL 'circle'
    SIZE 3
    LABEL
      PERCENTAGE 0.0 # position at start of line
      POSITION LL
      ANGLE AUTO
      OFFSET 5 5  # 5 pixels to the left, 5 pixels along direction of the line
      LABELITEM [LEFT_ADDR_FROM]
    END
    LABEL
      PERCENTAGE 0.0
      POSITION UL
      ANGLE AUTO
      OFFSET -5 5 # 5 pixels to the right, 5 pixels along direction of the line
      LABELITEM [RIGHT_ADDR_FROM]
    END
    LABEL
      PERCENTAGE 1.0
      POSITION LR
      ANGLE AUTO
      OFFSET 5 -5 # 5 pixels to the left, and 5 pixel before the end of line
      LABELITEM [LEFT_ADDR_TO]
    END
    LABEL
      PERCENTAGE 1.0
      POSITION UR
      ANGLE AUTO
      OFFSET -5 -5 # 5 pixels to the right, and 5 pixel before the end
      LABELITEM [RIGHT_ADDR_TO]
    END
    LABEL
      PERCENTAGE 0.5
      MINDISTANCE 200
      POSITION UC
      ANGLE AUTO
      LABELITEM [ROAD_NAME]
    END
  END
END

Change History (5)

comment:1 by woodbri@…, 18 years ago

Also see Bug#1547

comment:2 by sdlime, 15 years ago

Description: modified (diff)

Steve, hasn't this been addressed with the newest versions? Just cleaning house.

Steve

comment:3 by tspradley, 14 years ago

This is a greatly needed enhancement. I would like to be able to add the polygon labels considered in #8 & #9 which would be very useful when zoomed in along the boundaries of very large polygons in the case of states, or less known polygon shapes as in the case of school districts, or individual school areas.

comment:4 by woodbri, 14 years ago

Steve L. can you put a link to RFC or other doc the explains how this is supported. This issue just came up again with a client wanting house numbers like Google on their maps. I know that we added geometry processing capability, so we could use the to generate an end point of a linestring, but I'm not sure how I would generate a label aligned with the street and offset to the right or left with an appropriate label.

If I want four labels per linestring would I have to draw the layer 5 times? 1 for the linestring and 4 more for each of the 4 labels?

comment:5 by tbonfort, 13 years ago

Cc: tbonfort added
Keywords: tbonfort added
Note: See TracTickets for help on using tickets.