ok - got zoom to work - another question
Dylan Keon
keon at NACSE.ORG
Wed Nov 24 11:28:08 PST 2004
> On 11/24/2004 10:13 AM, Joseph Norris wrote:
>
>> The lengthy <elaborate kludge> that you mention is something I would
>
> like
>
>>to avoid due to the nature of the project. So that leaves me with the
>>open-ended question to all - what suggestions do any and all have with
>>regard to the last part of what I am trying to accomplish - namely - allow
>>the user to zoom into a polygon and see some representation of what's
>>there - a label of the actual number of teachers? I am opened to that but
>
> at
>
>>this point in my mapserver education, I am limited in my understanding of
>>Labeling. Can a label be placed within the minscale/maxscale scenario so
>>that when you zoom in you see the label and when you zoom out it
>
> disappears?
>
> Yes. Look for LABELMINSCALE and LABELMAXSCALE at
> http://mapserver.gis.umn.edu/doc42/mapfile-reference.html. Just store
> the desired label as an attribute within the shapefile. There are also
> ways to apply labels dynamically via mapscript.
>
> --Dylan
>
> On 11/24/2004 11:11 AM, Joseph Norris wrote:
>> Thanks Dylan,
>>
>> A question: I have found these parms labelminscale and labelmaxscale. How
>> do I set the label for "23 teachers" or "10 teachers" so that - as I
>> understand when the user zooms into a polygon, the see this label. Does that
>> have something to do with Feature object?
>>
Do you currently have those values (number of teachers) associated with
the polygons as an attribute in the shapefile? If so, it will be easy
to do the labeling via the mapfile. If not, you will need to figure out
a way to make the values available to mapserver/mapscript (not sure
which you're using). I did see you mention something about extracting
data from MySQL - is that where you're storing the values?
If you want to do it via the mapfile, you could use the TEXT attribute
to help with the labeling. In your case it would be something like
TEXT ([NUM_TEACH] teachers)
Example:
LAYER
NAME counties
TYPE POLYGON
DATA orcnty24
STATUS ON
LABELITEM "COUNTY_NAM"
LABELMINSCALE 540000
LABELMAXSCALE 2400000
CLASS
NAME "Counties"
OUTLINECOLOR 50 50 50
COLOR -1 -1 -1
TEXT ([COUNTY_NAM] CO)
LABEL
TYPE BITMAP
SIZE SMALL
POSITION CC
WRAP " "
COLOR 0 0 0
END
END
END
--Dylan
More information about the MapServer-users
mailing list