MapServer / MapServer-import

3 stars 2 forks source link

Improved Label Position Capabilities #1592

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: woodbri@swoodbridge.com Date: 2005/12/29 - 21:18

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
tbonfort commented 12 years ago

Author: woodbri@swoodbridge.com Date: 2005/12/30 - 06:01

Also see Bug#1547
tbonfort commented 12 years ago

Author: sdlime Date: 2009/04/04 - 20:29 Steve, hasn't this been addressed with the newest versions? Just cleaning house.

Steve

tbonfort commented 12 years ago

Author: tspradley Date: 2009/12/09 - 22:53 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.

tbonfort commented 12 years ago

Author: woodbri Date: 2009/12/20 - 06:10 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?