Stephan, unfortunately it is not really straightforward to work with dynamically created layers and p.mapper. This is due to the way how layers and groups are handled in p.mapper. For various reasons pmapper uses its own classes to store information about groups and layers. Among others, it was necessary as it is not possible to extend PHP Mapscript classes like 'normal' PHP classes, and the properties of the Mapscript classes cannot be save in the session.
So additionally of adding the newly created layer to the map, it also has to be added to the 'grouplist' array with all the required properties. This is not really easy to understand, I have to admit. Without that, not only the legend but also queries (and maybe other stuff) will not work. I am using dynamic layers for a few applications and always started with a more or less completely adapted way to create them. Since I was tired of this not very clever approach, I started for my last application a more standardized way to handle this. I will check the code and will make it available once it is a bit more tested. If you wish to have a look on it already now I can send you the required script. There is mainly one function that needs to be adapted to every application since there are indefinite ways to define layers with all kind of properties. The others should mainly be generic. Armin Stephan Holl wrote: > Dear list, > > does pmapper(1|2)s legend-tool provide any possibility to add a layer > dynamically during a session? > > I am thinking of adding a layer which is > the result of a calculation. I can make it appear on top of all layers > using mapscript, but it does not update the legend. > > Perhaps anybody can give me some pointers where to start. > Thanks for your suggestions. > > Best > > Stephan > > _______________________________________________ > Pmapper-users mailing list > Pmapper-users at faunalia.it > http://faunalia.it/cgi-bin/mailman/listinfo/pmapper-users > >
