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

Oliver Christen oliver.christen at camptocamp.com
Wed Nov 21 02:55:32 EST 2007


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 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/38b6be81/attachment-0001.html


More information about the Cartoweb-users mailing list