[Cartoweb-users] multiple scale dependent layers - one legend entry

karsten vennemann karsten at terragis.net
Wed Nov 21 08:01:24 EST 2007


Thanks for the tip. Yes the rivers LayerGroup was at the top level. I added
a container layer as suggested

 

layers.riversContainer.className = LayerGroup

layers.riversContainer.children =  rivers 

 

;LayerGroup rivers 

layers.rivers.className = LayerGroup

layers.rivers.children =  rivers_and_streams500k, rivers_and_streams50k,
rivers_and_streams50k_2, rivers_and_streams20k, rivers_and_streams1k

layers.rivers.label = Rivers

layers.rivers.icon = blank.png

layers.rivers.aggregate = true

 

If the aggregated LayerGroup rivers is the only layer in the Container
LayerGroup the checkbox did not get rendered when

layers.rivers.icon = blank.png

is set. When I uncomment the icon it does get rendered :-). I'm not sure
whether that is intended behaviour.

It does however always get rendered when I add more layers to the Container
LayerGroup. 

 

In my mapfile all the rivers layers are now set to

STATUS ON

The LayerGroup rivers shows up invisible /with a unchecked checkbox in the
legend, whereas another layer "counties" in my mapfile shows up visible (see
below).

How can I set the LayerGroup to be visible at the initial loading ?

 

Karsten

 

 

# Rivers

# Un-Tiled Layer

LAYER

            NAME "rivers_and_streams500k"

            # GROUP "Base Layers"

            TYPE LINE

            STATUS ON

            TEMPLATE "no template"

            MAXSCALE 5000000

            MINSCALE 500000

            TOLERANCE 5

            DATA "assets/mapdata/layers/hydrography/rivers/wa_rivers_500k"

            CLASSITEM "TYPE"

            CLASS

                        NAME "Rivers"

                        EXPRESSION "1"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 1

                        END

            END

END

# 50k Tiled Layer

LAYER

            NAME "rivers_and_streams50k"

            TYPE LINE

            STATUS ON

            TEMPLATE "no template"

            MAXSCALE 500000

            MINSCALE 350000

            TOLERANCE 5

            TILEINDEX
"assets/mapdata/layers/hydrography/rivers/wa_rivers_50k/index"

            TILEITEM "PATHNAME"

            CLASSITEM "TYPE"

            CLASS

                        # NAME "Type 1"

                        EXPRESSION "1"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 1

                        END

            END

END

# 50k Tiled Layer

LAYER

            NAME "rivers_and_streams50k_2"

            # GROUP "Base Layers"

            TYPE LINE

            METADATA

                        "RESULT_DESCRIPTIONS" "Name"

                        "RESULT_FIELDS" "NAME"

                        "PRINT_LEGEND" "FALSE"

            END

            STATUS ON

            TEMPLATE "no template"

            MAXSCALE 350000

            MINSCALE 200000

            TOLERANCE 5

            TILEINDEX
"assets/mapdata/layers/hydrography/rivers/wa_rivers_50k/index"

            TILEITEM "PATHNAME"

            CLASSITEM "TYPE"

            CLASS

                        # NAME "Type 1"

                        EXPRESSION "1"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 1

                        END

            END

END

# 20K Tiled Layer

LAYER

            NAME "rivers_and_streams20k"

            TYPE LINE

            STATUS ON

            TEMPLATE "no template"

            MAXSCALE 200000

            MINSCALE 100000

            TOLERANCE 5

            TILEINDEX
"assets/mapdata/layers/hydrography/rivers/wa_rivers_20k/index"

            TILEITEM "PATHNAME"

            CLASSITEM "TYPE"

            CLASS

                        # NAME "Type 1"

                        EXPRESSION "1"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 2

                        END

            END

            CLASS

                        # NAME "Type 2"

                        EXPRESSION "2"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 1

                        END

            END

END

# 1k Tiled Layer

LAYER

            NAME "rivers_and_streams1k"

            TYPE LINE

            STATUS ON

            TEMPLATE "no template"

            MAXSCALE 100000

            TOLERANCE 5

            TILEINDEX
"assets/mapdata/layers/hydrography/rivers/wa_rivers_1k/index"

            TILEITEM "PATHNAME"

            CLASSITEM "TYPE"

            CLASS

                        # NAME "Type 1"

                        EXPRESSION "1"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 3

                        END

            END

END

 

LAYER

            NAME "counties"

            DATA "mapdata/layers/political/wa_county"

            TYPE POLYGON

            STATUS ON

            TEMPLATE "no template"

            TRANSPARENCY 100

            CLASS

                        NAME "County Boundaries"

                        STYLE

                                    OUTLINECOLOR 255 255 255

                                    SYMBOL 'point'

                                    SIZE 1

                        END

            END

END

#####################################################################

 

 

  _____  

From: Oliver Christen [mailto:oliver.christen at camptocamp.com] 
Sent: Tuesday, November 20, 2007 23:56
To: karsten vennemann; cartoweb-users at lists.maptools.org
Subject: Re: [Cartoweb-users] multiple scale dependent layers - one legend
entry

 

Hi

 

this is only a supposition as I dont see all your layers.ini, but I think
your actual rivers LayerGroup is a "top level" LayerGroup, meaning it is
rendered as a block and not as a checkbox "layer".

 

try to add a new LayerGroup that will simply be used to generate the block
and set your rivers LayerGroup as its children, that way the rivers
LayerGroup should be displayed with a checkbox as any normal layer

 

layers.riversContainer.className = LayerGroup

layers.riversContainer.children =  rivers 

 

regards

Oliver

----- Original Message ----- 

From: karsten <mailto:karsten at terragis.net>  vennemann 

To: cartoweb-users at lists.maptools.org 

Sent: Wednesday, November 21, 2007 8:40 AM

Subject: [Cartoweb-users] multiple scale dependent layers - one legend entry

 

Hi all.

 

I was experimenting with several layers of rivers that are visible on
different scale. On mapserver "only" I had several layers of river data just
having the same name that would become active when zooming in or out. That
does not seem to work in cartoweb and most of the time is giving be an error
message similar to failure - "trying to replace layer rivers".

My goal was to have just one entry in the legend "Rivers" and different
layers (scale dependant will become active). In my mapfile this is like
this:

 

LAYER

            NAME "rivers_and_streams500k"

            TYPE LINE

            STATUS DEFAULT

            TEMPLATE "no template"

            MAXSCALE 5000000

            MINSCALE 500000

            TOLERANCE 5

            DATA "mapdata/layers/hydrography/rivers/wa_rivers_500k"

            CLASSITEM "TYPE"

            CLASS

                        NAME "Rivers"

                        EXPRESSION "1"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 1

                        END

            END

END

 

# 50k Tiled Layer

LAYER

            NAME "rivers_and_streams50k"

            TYPE LINE

            STATUS ON

            TEMPLATE "no template"

            MAXSCALE 500000

            MINSCALE 350000

            TOLERANCE 5

            TILEINDEX
"mapdata/layers/hydrography/rivers/wa_rivers_50k/index"

            TILEITEM "PATHNAME"

            CLASSITEM "TYPE"

            CLASS

                        # NAME "Type 1"

                        EXPRESSION "1"

                        STYLE

                                    COLOR 128 170 255

                                    SYMBOL "point"

                                    SIZE 1

                        END

            END

END

 

and so on.

In my layers.ini file I have:

 

;LayerGroup rivers 

layers.rivers.className = LayerGroup

layers.rivers.children =  rivers_and_streams500k, rivers_and_streams50k,
rivers_and_streams50k_2, rivers_and_streams20k, rivers_and_streams1k

layers.rivers.label = Rivers

layers.rivers.icon = blank.png

layers.rivers.aggregate = true

 

layers.rivers_and_streams500k.className = Layer

layers.rivers_and_streams500k.msLayer = rivers_and_streams500k

layers.rivers_and_streams500k.label = Rivers

 

layers.rivers_and_streams50k.className = Layer

layers.rivers_and_streams50k.msLayer = rivers_and_streams50k

layers.rivers_and_streams50k.label = Rivers

 

layers.rivers_and_streams20k.className = Layer

layers.rivers_and_streams20k.msLayer = rivers_and_streams20k

layers.rivers_and_streams20k.label = Rivers

 

Now when I set

layers.rivers.aggregate = true

the legend appears perfectly how I would like it (just one layer "rivers"
plus icon shown. However, there is no checkbox to switch it on, nor does the
data ever display on the map ( no matter which scale I zoom to).

 

When I set 

layers.rivers.aggregate = false

the on/off checkbox is there and I can switch on and see the layers (e.g.
rivers_and_streams500k) , however the legend displays entries for each of
the other (still invisible layers).

 

Is there a way to have the layers display as one in the legend and display
on the map?

 My understanding of the documentation is that this should be possible using


layers.rivers.aggregate = true

 

Did I do anything wrong to make that work?

or is there another way to exclude layers from showing up in the legend but
still be visible on the map ?

 

Cheers

Karsten


  _____  


_______________________________________________
Cartoweb-users mailing list
Cartoweb-users at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20071121/ca2e0a98/attachment-0001.html


More information about the Cartoweb-users mailing list