Setting attributes of shapes on php-mapscript

Blaise bpicinbono at WORLDONLINE.FR
Tue Jul 17 09:31:23 EDT 2007


Le lundi 16 juillet 2007 21:13, Francesco Antognini a écrit :
> 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

Hi
Assuming your are working with esri shape files (*.shp, *shx, and *.dbf), 
php_mapscript allows you to add new shapes and you can use php dbase 
functions to add new records (and datas) to the dbf file.
Have a look over here :
http://www.php.net/manual/en/ref.dbase.php
Regards
Blaise



More information about the mapserver-users mailing list