[mapserver-users] Real dynamic legends

Armin Burger armin.burger at libero.it
Thu Oct 10 01:18:43 PDT 2002


Steve,

thanks for the reply.

>> Hello everybody,

> Hi Armin:

/.../

>> One restriction of this approach I found is that it seems not
>> to be possibleto get class expressions via MapScript. A
>> question to the PHP MapScript developers: Would it be possible
>> to add this possibility to MapScript?

> I'm not sure what you mean by "get class expressions". I believe
> the perl/python version has a classify method that will allow a
> shape to be evaluated for a given layer. I'll have to check though.

# When trying to find a way to implement dynamic legends via
queryByRect I stumbled over the missing possibility in
PHP/MapScript to retrieve class expressions via
'$classObj->expression'. It seems to be one of the few members
of a layer class that cannot be read via MapScript.

/.../

>> Therefore a question to the MapServer developers: Is it
>> conceivable to implement such a dynamic legend function
>> directly in the main MapServer functionality?

> It's possible. We would just need to add a bit of book keeping
> to the map file structure (i.e. like keeping a count of drawn
> features by class). This might make the mapfile structures less
> thread safe though....

/.../

>> Regarding MapScript functionality I'm thinking of a function
>> like $map->drawDynLegend() that instead of an image returns a
>> multiple array of active layers with a sub-array of affected
>> classes (classes in the current extent) for each layer. One
>> could then  use these classes and draw the legend icons for
>> them.

> I would propose extending the legend object by adding a "type"
> parameter.

# I don't have an idea how map file classes are processed via
the rendering. So I don't know the efforts to keep track of
already processed layers and classes and give them out finally. Maybe
it's easier to write directly a legend instead of
producing lists. For the cgi version I assume this the best
solution.

With MapScript one has the possibility to create very
flexible and nice legends via the layer classes and producing
single legend icons and mixing them with HTML text. Therefore a perfect
solution for me would be some kind of list or array of layers and
classes as an output of a dynamic legend function.
I think that probabaly updating dynamic legends would be
done anyway via an 'update' button in the user interface and
not automatically for every zoom/pan action.



> Steve

Armin





More information about the MapServer-users mailing list