Force label for tiny polygon

Steve Lime Steve.Lime at DNR.STATE.MN.US
Thu May 3 01:18:16 EDT 2007


MapServer removes colinear points when it converts features from map to
image coordinates and if a feature is small enough it will collapse down
to a single point, and since a polygon must have at least 3 points it's
possible the code stops right there and never even tries to place a
label (or draw the feature). So, Norman's idea is your best bet since
points don't degenerate like that. You might also try an ANNOTATION
layer but I believe is uses the same colinear conversion and filtering.

Steve

>>> Norman Vine <nhv at CAPE.COM> 05/02/07 9:30 AM >>>
Jørn Vegard Røsnes
> 
> when I change the type from polygon to point, the label is 
> always visible. 
> Unfortunately I get one label for each point in the polygon. 
> Not very readable :-)

Add a separate layer of points for your labels

This gives you much finer grain control

I usually use the polygon centroids for this

Cheers

Norman

> 
> 
> On Wednesday 02 May 2007 15:21, Jørn Vegard Røsnes wrote:
> > Hi all,
> >
> > I want to always display the label for a tiny polygon (oil spill).
> >
> > I feel I've tried many configurations now in the map file, but I 
> > always have to zoom in (from all of Europe, to only coastline of 
> > Portugal), before the label is visible. Here is the current 
> layer definition:
> >
> > LAYER
> >      NAME "oilspill_20070502_141558"
> >      CONNECTIONTYPE POSTGIS
> >      CONNECTION "user=postgres dbname=konserv host=hostname 
> port=5432"
> >      DATA "poly from feature using SRID=4326"
> >      TYPE polygon
> >      #STATUS ON
> >      #TRANSPARENCY 0
> >      DEBUG ON
> >      LABELCACHE ON
> >      LABELITEM "timestamp"
> >      CLASS
> >           #TEXT ([oid]-[timestamp])
> >           EXPRESSION ('[timestamp]' == '20070502_141558' AND 
> > [threshold] >= 0 AND [threshold] < 100)
> >           LABEL
> >             FONT arial
> >             TYPE TRUETYPE
> >             SIZE 7
> >             MINDISTANCE 10
> >             BUFFER 1
> >             POSITION UR
> >             ANGLE AUTO
> >             COLOR 0 0 0
> >             FORCE TRUE
> >           END
> > #          STYLE
> > #             SYMBOL 0
> > #             SIZE 6
> > #             COLOR 224 64 0
> > #          END
> >           COLOR 224 64 0
> >      END
> >      PROJECTION
> >         "init=epsg:4326"
> >      END
> > END
> >
> > Thanks
> >
> > cheers
> > Joern Vegard



More information about the mapserver-users mailing list