[mapserver-users] ms_newLayerObj (fwd)

Assefa Yewondwossen assefa at dmsolutions.ca
Wed Oct 10 13:41:52 PDT 2001


Hi There,

 I just tested the creation of layers dynamically using php/mapscript and It seems to
work fine.

 From the code bellow I think the only problem in your case is the way you define the
colors. You should do soemthing like this :
....
$newclass = ms_newClassObj($newlay);
$colorId = $map->addColor(0, 0, 255);
$newclass->set("outlinecolor", $colorId);
...

I am assumoing here that all the seeting of the other parameters (like data, ...) are
correct.

Hope it helps,

Later,


teb wrote:

> ------------- Begin Forwarded Message -------------
>
> From: Øyvind Idland <oyvind.idland at powelgemini.no>
> To: <mapserver-info at lists.gis.umn.edu>
> Subject: ms_newLayerObj
> Date: Mon, 8 Oct 2001 16:18:32 +0200
> MIME-Version: 1.0
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
> Content-Transfer-Encoding: 8bit
> X-MIME-Autoconverted: from quoted-printable to 8bit by mallit.fr.umn.edu id JAA14289
>
> Hello
>
> I am currently testing Mapscript 3.4 with php 4.05, running as cgi under IIS.
> Since I want to use points/objects from a database (via odbc), i want to create
> layers on the fly. For some reason, the layer refuses to draw.
>
> I used following lines:
>
>  $map = ms_newMapObj("C:\inetpub\wwwroot\oi\oi.map");
>  $newlay = ms_newLayerObj($map);
>  $newlay->set("name", "db_layer");
>  $newlay->type = MS_LAYER_POINT;
>  $newlay->status = MS_ON;
>  $newclass = ms_newClassObj($newlay);
>  $newclass->outlinecolor = 0;
>  $newclass->symbol = 3;
>  $newclass->size = 10;
>
> and then the nessesary database / point adding stuff.
> (This works fine if I define the layer in the .map file)
> There are already 2 other layers on the map, so this is the 3rd layer.
> $map->numlayers returns 2, (there should be 3 ?) and $newlay->index returns 1.
>
> Is this a bug ? :)
>
> Anyway, thanks for a powerful tool.
>
> Oyvind Idland,  Powel Gemini A/S
> mailto:oyvind.idland at powelgemini.no
>
> ------------- End Forwarded Message -------------

--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056
----------------------------------------------------------------





More information about the MapServer-users mailing list