Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4251 closed defect (fixed)

POSITION AUTO bug with SYMBOL

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

Description

I have the following CLASS definition for labeling a polygon with a symbol and text. It behaves correctly with POSITION UL|CL|LL|LC|LR|CR|UR|UC but places the text on the the SYMBOL if I use POSITION AUTO.

    LAYER
        NAME "area_landmarks"
        TYPE POLYGON
        TILEINDEX "tidx-AREALM"
        PROJECTION
            "+proj=longlat +ellps=GRS80 +datum=NAD83" #EPSG: 4269
        END
  MAXSCALEDENOM 2500000
  CLASSITEM "MTFCC"
  LABELITEM "FULLNAME"
  CLASS
    EXPRESSION /^K2561/ # Golf
    STYLE
      COLOR "#C9DFAF"
    END
    LABEL
      STYLE
        SYMBOL "golf"
        SIZE 24
      END
      MAXSCALEDENOM 200000
      TYPE TRUETYPE
      FONT "sans"
      SIZE 7
      COLOR "#24471C"
      OUTLINECOLOR "#E5F0D8"
      PARTIALS FALSE
      MINDISTANCE 250
      MINFEATURESIZE 10
      BUFFER 4
      POSITION AUTO # UL|CL|LL|LC|LR|CR|UR|UC all work:
      PRIORITY 4
      WRAP " "
      ALIGN CENTER
    END
  END
END

I have attache an image showing the placement of the symbols and text for the various cases.

Attachments (1)

bug-position-auto.png (23.8 KB ) - added by woodbri 12 years ago.

Download all attachments as: .zip

Change History (6)

by woodbri, 12 years ago

Attachment: bug-position-auto.png added

comment:1 by tbonfort, 12 years ago

for polygon type layers, the first position tried is CC, which is why you're seeing collisions. We should adapt the code so that CC is not the default position if a marker is also defined.

comment:2 by woodbri, 12 years ago

yes, I would agree with that. This only impacts POSITION AUTO so if we skip CC with a marker it should work great like the manual test cases.

comment:3 by tbonfort, 12 years ago

r13279 probably fixes this, but I have not tested. please close if ok.

comment:4 by woodbri, 12 years ago

Resolution: fixed
Status: newclosed

Thomas,

Here is a mapfile I built for testing the label position with a symbol. You might want to add it to msautotest stuff.

map
  name "label-position-auto"
  status on
  size 300 300
  extent 0 0 300 300
  imagetype "agg_qn"
  imagecolor "#a5bfdd"

  outputformat
    name "agg_qn"
    driver "AGG/PNG"
    extension "png"
    mimetype "image/png"
    imagemode "RGB"
    FORMATOPTION "INTERLACE=false"
    FORMATOPTION "QUANTIZE_NEW=ON"
    FORMATOPTION "QUANTIZE_FORCE=ON"
    FORMATOPTION "QUANTIZE_DITHER=OFF"
    FORMATOPTION "QUANTIZE_COLORS=256"
  end

  symbol
    name "circle"
    type ellipse
    filled true
    points 1 1 end
  end

  layer
    status default
    type polygon
    feature
      points 0 0 100 0 100 100 0 100 0 0 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'LL'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position ll
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 100 0 200 0 200 100 100 100 100 0 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'LC'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position lc
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 200 0 300 0 300 100 200 100 200 0 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'LR'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position lr
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 0 100 100 100 100 200 0 200 0 100 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'CL'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position cl
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 100 100 200 100 200 200 100 200 100 100 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'AUTO'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position auto
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 200 100 300 100 300 200 200 200 200 100 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'CR'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position cr
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 0 200 100 200 100 300 0 300 0 200 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'UL'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position ul
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 100 200 200 200 200 300 100 300 100 200 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'UC'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position uc
      color "#000000"
    end
    end
  end

  layer
    status default
    type polygon
    feature
      points 200 200 300 200 300 300 200 300 200 200 end
    end
    class
    style
      color "#888888"
      outlinecolor "#000000"
    end
    label
      text 'UR'
      style
        symbol "circle"
        size 10
        color "#ff0000"
      end
      size tiny
      position ur
      color "#000000"
    end
    end
  end

end

trunk looks good this your checkin. Closing this as fixed.

comment:5 by tbonfort, 12 years ago

test added in r13283

Note: See TracTickets for help on using tickets.