Setting attributes of shapes on php-mapscript
Rodrigo Del C. Andrade
rodrigo.andrade at DIGITRO.COM.BR
Tue Jul 17 06:21:46 PDT 2007
Hi.
As of mapscript 4.10 you need to initialize the shapes to receive
values.
try issuing a
$shp->initValues(1);
before setValue. The int argument is the number of values you will
set in that shape.
I know this was changed for the SWIG versions of mapscript, I am not
sure about it on the PHP front, but someone will correct me if its not
the case.
Cheers,
Rodrigo
--
*Rodrigo Del C. Andrade*
/Programador/
/SIC - SSE - Soluções Segurança Pública/
*DÍGITRO TECNOLOGIA*
*E-mail:* rodrigo.andrade at digitro.com.br
<mailto:rodrigo.andrade at digitro.com.br>
*Fone:* +55 48 3281-7314 / +55 48 3281-7000
*Fax:* +55 48 3281-7299
*Site:* www.digitro.com <http://www.digitro.com>
Francesco Antognini wrote:
> Hello
> I'm stuck with this and need advice. I'm working with ms4w version 2.2.3.
>
> In php mapscript, I'm trying to assign values to attributes of newly
> created shape objects. However, whatever I do it doesn't seem to work.
>
> First of all shapeobj->setValue() is not defined:
>
> $shpn= ms_newShapeObj(MS_SHAPE_POLYGON);
> $shpn->setvalue(0,"foobar"); // >>> php generates error
>
> Then setting the directly the values array works on the php object:
>
> $shpn->value[0]='bar';
> $shpn->value['foo']='bar';
>
> However changes are never transferred to the actual peer in the layer,
> as print_r clearly shows:
>
> .... [values] => Array ( ) .....
>
>
> At this point I wonder whether this is possible at all, at least in
> php-mapscript. If anyone can give me hint it would be very helpful.
> Even a negative one.
> TIA
> F. Antognini
>
> --
> Francesco Antognini
> Computer Consultant
> Switzerland
> fantognini at gmail.com <mailto:fantognini at gmail.com>
More information about the MapServer-users
mailing list