Hide and show city labels depending on population

Rodrigo Martín LÓPEZ GREGORIO rodrigomlg at GMAIL.COM
Tue Jul 10 05:32:29 PDT 2007


Hi Milo.

I think your problem is that you have no defined the MAXSCALE of the medium
cities. This parameter tell mapserver at wich scale will stop drawing the
elements of a layer (MINSCALE is how far in (MAXSCALE how far out) will be
drawed the elements).

So, i think if you add a MAXSCALE to the medium cities CLASS your problem
will be solved:

LABELITEM 'City'
    CLASSITEM 'City_Population'
    CLASS
      MAXSCALE 80000
      NAME '0 < City_Population < 100000'
      EXPRESSION ( ([City_Population] >= 0) AND ([City_Population] <=
100000) )
      STYLE
        SYMBOL 'CIRCLE'
        SIZE 3
          OUTLINECOLOR 0 0 0
          COLOR 255 170 0
        END
     LABEL
      TYPE TRUETYPE
      FONT Arial
      SIZE 8
      COLOR 255 255 250
      #OUTLINECOLOR 255 255 255
      ANTIALIAS TRUE
      MINFEATURESIZE 500
      ANGLE 0
      FORCE false
     END
    END
    CLASS
      NAME '100001 < City_Population < 500000'
      EXPRESSION ( ([City_Population] >= 100001) AND ([City_Population] <=
500000) )
      STYLE
        SYMBOL 'CIRCLE'
        SIZE 4
          OUTLINECOLOR 0 0 0
          COLOR 255 170 0
        END
     LABEL
      TYPE TRUETYPE
      FONT Arial
      SIZE 10
      COLOR 255 255 250
      #OUTLINECOLOR 255 255 255
      ANTIALIAS TRUE
      MINFEATURESIZE 500
      ANGLE 0
      FORCE false
     END
    END

The MAXSCALE value will depend on your map.

I hope it works.

Rodrigo.
On 7/10/07, Milo van der Linden <mlinden at zeelandnet.nl> wrote:
>
>  Hello list,
>
> I have been puzzling a bit and am not finding the correct answer.
>
> I have a city mapinfo tab that holds population values. I want to display:
> - The labels of the major cities when zoomed out far,
> - add the labels of medium cities when I zoom in further
> - show all labels when zoomed in max
>
> Currently my syntax in the mapfile is as below, but I can't get a map that
> shows only the labels of the major cities!
>
> Any help is appreciated
>
> LABELITEM 'City'
>     CLASSITEM 'City_Population'
>     CLASS
>       NAME '0 < City_Population < 100000'
>       EXPRESSION ( ([City_Population] >= 0) AND ([City_Population] <=
> 100000) )
>       STYLE
>         SYMBOL 'CIRCLE'
>         SIZE 3
>           OUTLINECOLOR 0 0 0
>           COLOR 255 170 0
>         END
>      LABEL
>       TYPE TRUETYPE
>       FONT Arial
>       SIZE 8
>       COLOR 255 255 250
>       #OUTLINECOLOR 255 255 255
>       ANTIALIAS TRUE
>       MINFEATURESIZE 500
>       ANGLE 0
>       FORCE false
>      END
>     END
>     CLASS
>       NAME '100001 < City_Population < 500000'
>       EXPRESSION ( ([City_Population] >= 100001) AND ([City_Population] <=
> 500000) )
>       STYLE
>         SYMBOL 'CIRCLE'
>         SIZE 4
>           OUTLINECOLOR 0 0 0
>           COLOR 255 170 0
>         END
>      LABEL
>       TYPE TRUETYPE
>       FONT Arial
>       SIZE 10
>       COLOR 255 255 250
>       #OUTLINECOLOR 255 255 255
>       ANTIALIAS TRUE
>       MINFEATURESIZE 500
>       ANGLE 0
>       FORCE false
>      END
>     END
>  --
>
>
>  Milo van der Linden
> mlinden at zeelandnet.nl
> milovanderlinden at gmail.com
> milo at 3dsite.nl
> http://www.3dsite.nl
>
>
> De informatie in dit bericht reflecteerd mijn persoonlijke mening en niet
> die van een bedrijf of instantie. Aan de informatie kunnen geen rechten
> worden ontleend. Indien dit bericht onderdeel is van een forum, mailing-list
> of community dan gelden automatisch de bijbehorende voorwaarden.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070710/32391a2a/attachment.htm>


More information about the MapServer-users mailing list