[mapserver-users] PHP Mapscript question

Daniel Morissette dmorissette at mapgears.com
Thu Apr 3 12:00:40 PDT 2008


alim karim wrote:
> 
> i would also like the user to be presented with a list of all the 
> symbols defined in the mapfile that i am working with. i have gone 
> through the API but haven't come across any functions that will allow me 
> to accomplish this. does such functionality exist in the API?
> 

The mapObj's getNumSymbols() and getSymbolObjectById() methods should 
allow you to do something like this (untested):


   $numsymbols = $map->getNumSymbols();

   # Start looping at 1 since symbol 0 is the default symbol
   for ($id=1; $id < $numsymbols; $id++)
   {
     $symbol = $map->getSymbolObjectById($id);
     # Do something with $symbol here... see the symbolObj class docs...
   }

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/



More information about the MapServer-users mailing list