Set the background color

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Set the background color

krishna_s
Hello all, i want to set the background color, boundary color using a php
mapscript function/method, but i couldnt find anyhelp full method which
sets the background color and the boundary color. Could anyone please help
me out in this ....

Kris
Reply | Threaded
Open this post in threaded view
|

Re: Set the background color

Dylan Keon-3
On 01/23/2006 02:53 PM, krishna S wrote:
> Hello all, i want to set the background color, boundary color using a php
> mapscript function/method, but i couldnt find anyhelp full method which
> sets the background color and the boundary color. Could anyone please help
> me out in this ....

Do you mean for a layer?  This is the general procedure:

$layer = $map->getLayerByName('layer_name'); //$map is map object
$class = $layer->getClass(0); //0 is first class in layer
$style = ms_newStyleObj($class);
$style->color->setRGB(220,220,220); //background color
$style->outlinecolor->setRGB(255,255,0); //boundary color

--Dylan
Reply | Threaded
Open this post in threaded view
|

Re: Set the background color

krishna_s
In reply to this post by krishna_s
Thanks for your reply dylan, it worked ...
Reply | Threaded
Open this post in threaded view
|

Re: Set the background color

Dylan Keon-3
In reply to this post by Dylan Keon-3
Please reply to the list if possible, that way everyone can learn from
the information :-)  Comments below...

On 1/24/06, kris rock <[hidden email]> wrote:
> Hi dylan sorry to bother you but i have a couple more questions too, i was
> trying to set the font and the fontsize of the label on the layer but its
> giving me some errors, it might be because i am not using the correct
> syntax. I am using the following lines to set the font and font size ...
>
> $label=ms_newLabelObj($class);
> $label->font('arial');


The labelObj is embedded in classes, so you can just do this:

$class->label->set(type, MS_TRUETYPE);
$class->label->set(font, 'arial');
$class->label->set(size, 10);
$class->label->color->setRGB(64,64,64);


> i dont know how to create a new label object, could you please help me out
> in this.
> I have one more question too, how to set the filltransperancy and
> boundarytransperancy for a layer.


There isn't a separate outline transparency (as far as I know).
TRANSPARENCY affects the entire layer, including the outlinecolor.
Try this:

$layer->set(transparency, 50);


> Can i know where can i find good mapscript examples ....

That is a good question.  Probably the best source is the
mapserver-users archives, which you can access via the new MapServer
website: http://mapserver.gis.umn.edu/community/mailinglists/mapserver-users/

There are also some examples under the "howto" section of the
Documentation area.

--Dylan



> Thanks for your time and sorry to bother you ...
>
> Kris
>
>
> Dylan Keon <[hidden email]> wrote:
>
> On 01/23/2006 02:53 PM, krishna S wrote:
> > Hello all, i want to set the background color, boundary color using a php
> > mapscript function/method, but i couldnt find anyhelp full method which
> > sets the background color and the boundary color. Could anyone please help
> > me out in this ....
>
> Do you mean for a layer? This is the general procedure:
>
> $layer = $map->getLayerByName('layer_name'); //$map is map
> object
> $class = $layer->getClass(0); //0 is first class in layer
> $style = ms_newStyleObj($class);
> $style->color->setRGB(220,220,220); //background color
> $style->outlinecolor->setRGB(255,255,0); //boundary color