[mapserver-users] Change scalebar background color using php/mapscript

Daniel Morissette morissette at dmsolutions.ca
Fri Aug 30 08:24:47 PDT 2002


"Van Ulden, Joost" wrote:
> 
> Thanks, it works for the background color but for some reason it doesn't
> work for the image color.  We get the following error:
> 
> Property 'IMAGECOLOR' does not exist in this object
> 

If you look carefully at the mapscript docs you'll notice that
'imagecolor' is of type colorObj instead of type integer.  This makes
things a bit confusing, but it's related to the way things work
internally in MapServer (parsing of the mapfile, etc.)... almost
everywhere in the mapscript colors are stored as a color index, the
imagecolor property is one of the very few exceptions that are stored as
a colorObj (R, G, B values).

So to set it you can use:

 $map->scalebar->imagecolor->setRGB( 255, 255, 255 );

-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.



More information about the MapServer-users mailing list