LabelRequires & MS 4.4.0

Steve Lime steve.lime at DNR.STATE.MN.US
Thu Dec 23 12:02:47 EST 2004


Gee and I figured nobody would ever see that error message. Guess it was
worth pulling my hair out.

Anyway, your statement: LABELREQUIRES "[district] = 1" is invalid.
LABELREQUIRES is used to toggle labeling based on the status of OTHER
layers. For example, you might not want to show lake labels if you're
displaying a scanned map as a backdrop that already has them. Your use
of LABELREQUIRES basically draw labels if the layer is on. That's how
MapServer works by default so it's unnessesary. Remove that line and you
should be fine. If you have 2 layers called district then you'll need to
rename one.

You cannot reference the current layer nor other layers that depend on
the current layer in REQUIRES or LABELREQUIRES statements. Otherwise you
will get the recursion error.

Steve


>>> Jerod Clabaugh <jclabaugh at MAC.COM> 12/22/2004 6:26:50 PM >>>
All:

I have a quick question regarding LABELREQUIRES syntax.  See mapfile
below.  I want to only show this district label layer if 'district'
layer is ON.

This layer syntax below worked fine in MS 4.2.6, but upon switching
to MS 4.4.0, I get the following error

        msValidateContexts: Recursion error found for LABELREQUIRES
parameter for layer district.

I checked the lastest mapfile manual online and the mapserver list
archives and tried various permutations, all to no avail.

Anyone have a solution?

Cheers,

Jerod

########## BEGIN DISTRICT LABELS LAYER
LAYER
        CONNECTIONTYPE postgis
        NAME district
        GROUP 'People & Society'
        CONNECTION "user=xxxxxx dbname=xxxxxx password=xxxxxx
host=localhost"
        DATA "the_geom from shape_district using SRID=26716 using
unique oid"
        TYPE ANNOTATION
        STATUS DEFAULT
        DUMP TRUE
        MINSCALE 0
        MAXSCALE 1000000

        LABELITEM "district"
        LABELREQUIRES "[district] = 1"

        CLASSITEM "district"
        CLASS
                COLOR -1 -1 -1
                LABEL
                        TYPE TRUETYPE
                        FONT "Vera"
                        SIZE 9
                                COLOR 0 0 0
                        SHADOWCOLOR 218 218 218
                        SHADOWSIZE 1 1
                        ANTIALIAS TRUE
                        POSITION Cc
                        PARTIALS FALSE
                        MINDISTANCE 100
                        MINFEATURESIZE 100
                        WRAP "\n"
                        OFFSET 3 3
                        BUFFER 4
                END # end of label
        END # end of class object
        METADATA
                WMS_TITLE "District Labels"
                WMS_ABSTRACT "District shapefile."
                WMS_SRS "EPSG:26716"
                WMS_SHOWINLEGEND "no"
        END # end of metadata object
END
########## END DISTRICT LABELS LAYER



More information about the mapserver-users mailing list