[mapserver-users] Getting dynamically created layers to display using PHP

Tim Sutton sutton_t at giug.net
Tue Oct 9 03:16:52 EDT 2001


Hi

I cant figure out why my dynamically created layers don't appear when
the map is rendered. I have one layer defined in my map file (why
renders fine) and I am trying to add another dynamically. The debug
stuff shows the layer is created as numlayers goes from 1 to 2 and the
status debug shows 1. Also, the new layer does not appear in the
legend??

Any help will be greatly appreciated.

Tim (php code snippet follows)

$gpoMap = ms_newMapObj("uk.map");
printf("0: Numlayers :  %d\n<br>\n",$gpoMap->numlayers);
//create a layer on programmatically
$myLayer = ms_newLayerObj($gpoMap);
$myLayer->set("name", "UK");
$myLayer->set("type", MS_LAYER_POLY);
$myLayer->set("status", MS_ON);
$myLayer->set("data","ponet");
$myLayer->setMetaData("DESCRIPTION",	"UK Boundaries");
$newclass = ms_newClassObj($myLayer);
$newclass->set("outlinecolor",0);
printf("1: Numlayers : %d\n<br>\n",$gpoMap->numlayers);
printf("Status %s",	%$myLayer->status);
$img = $gpoMap->draw();
$myLayer->draw($img);




More information about the mapserver-users mailing list