Layer conditional on some other layer(s) being drawn

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Thu Oct 21 10:30:17 PDT 2004


Hi all,

I would like to be able to draw a layer, BUT only if some other layer(s)
got drawn. The purpose for this is to be able to generate conditional
copyrights on the map.

Here is the scenario, I have multiple vendor data sets all pulled
together into a mapfile, but depending on scale and location I might
only render data from some of the vendor data. Then as the last layers
being drawn are the copyrights, I only want to place the copyrights
required based on the data that was actually rendered.

I'm thinking of a mechanism like:

LAYER
   NAME "abc"
   SET_IF_DRAWN vendor1 1
   ...
END
LAYER
   NAME "xyz"
   SET_IF_DRAWN vendor2 1
   ...
END
...
LAYER
   NAME "copyright1"
   STATUS OFF
   IF vendor1 and not vendor2 STATUS ON
   ...
END
LAYER
   NAME "copyright2"
   STATUS OFF
   IF vendor2 and not vendor1 STATUS ON
   ...
END
LAYER
   NAME "copyright3"
   STATUS OFF
   IF vendor1 and vendor2 STATUS ON
   ...
END

-- OR --

LAYER
   NAME "copyright"
   STATUS DEFAULT
   ...
   IF vendor1 and not vendor2 TEXT "bla bla bla 1"
   IF vendor2 and not vendor1 TEXT "bla bla bla 2"
   IF vendor1 and vendor2 TEXT " bla bla bla 1 and 2"
   ...
END

I think that there are probably other good uses of this besides the
example above. The key to this is that the variable only gets set if
data is actually rendered into the image. If later layer obliterates
what was drawn, that can be ignored and the variable would stay set.

Would this be useful to others?
Any ideas how to hack something like this with todays tools?

Opened a bug you can add comments to:
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=980

-Steve



More information about the MapServer-users mailing list