[mapserver-users] Loading layers with mapscript on an empty map object in PHP

Rob Martinson cathode at nichebox.com
Sun Jul 1 15:24:17 PDT 2001


I'm attempting to load layers from a database on an empty map object.
This way I can control all of the maps from a database without writing
out a new .map file for each change. Currently I'm trying:

dl("php_mapscript.so");
$map = ms_newMapObj('');
$map->set("width",400);
$map->set("height",300);
$map->set("shapepath","/path/to/my/data");

$layer = ms_newLayerObj($map);
$layer->set("name","county");
$layer->set("type",POLYGON);
$layer->set("status",MS_ON);
$layer->set("data","ctybdpy");

$img = $map->draw();   <--at this point I get an error stating "Object
has an invalid _handle_ property"

The same small script and data work if I load the layers through a .map
file using the same paths with:

dl("php_mapscript.so");

$map = ms_newMapObj("demo2.map");
$img = $map->draw();

I'm sure someone else has done something similar. Any pointers?

Rob Martinson
Nichebox - http://www.nichebox.com
Development - http://dev.nichebox.com 




More information about the MapServer-users mailing list