PHP/Mapscript - Layer Color

Gheysen Thibaut gheysen.t at SKYNET.BE
Thu Sep 2 11:12:10 EDT 2004


Hi,

Here is a section of my code that change the color of a layer :

// return the class object : 0 is the first class

$class = getClass(0);

// return the style object : 0 is the first style

$style = getStyle(0);

// change the bgcolor

$style->color->setRGB(0, 0, 0);

// change the outline color

$style->outlinecolor->setRGB(0, 0, 0);

I hope that I can help you.

Best regards,

Thibaut.

Terry Wood a écrit :

> Greetings,
>    I am using PHP/Mapscript version 4.2.2 and I cannot figure out how
> to change the color of a layer. If I filter an existing layer (with a
> WHERE clause) I get output, but I cannot change the color of the layer
> on the screen.
>
> Here is a section of my code :
>
> // Load Mapscript
> dl("php_mapscript.so");
>
> <>// Load MapServer .map file
>
> <>$map = ms_newMapObj("/data/maps/hpWork.map");
>
> // Query
>
> $layer = ms_newLayerObj($map, $map->getLayerByName("Parcels"));
>
> $layer->setFilter("parcelid IN
> ('0000-27-009-012-0-001-01','0000-14-008-008-0-001-01')");
>
> $layer->set("status",MS_ON);
>
> // Draw Map
>
> $img = $map->draw();
>
> $url = $img->saveWebImage();
>
>
> I am not going to show all of my failed attempts at changing the layer
> colors... Anybody know how to do this?
>
> Terry Wood



More information about the mapserver-users mailing list