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

karsten vennemann karsten at terragis.net
Wed Nov 21 02:40:44 EST 2007


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

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


More information about the Cartoweb-users mailing list