[Mapserver-users] creating class dinamicaly from mapscript: how could if works without failing?

Eduardo Patto Kanegae eduardo at consultoria.eti.br
Thu Jun 17 14:27:41 EDT 2004


I'm using PHPMapScript to generate classes for a given layer using the following code:

while (!$vwCommPlaceTypes->EOF){
 	$stClass = ms_newClassObj($hTmpLayer);
	$stClass->set("name",$vwCommPlaceTypes->fields["tip_descricao"]);
	$stClass->setexpression("(('[TIP_CODIGO]' eq '".trim($vwCommPlaceTypes->fields["tip_codigo"])."') AND ([FLAGS] > 0))");		
	$vwCommPlaceTypes->MoveNext();
}

and the final step is $map->save()

but i'm curious: how this work so well if for each iteration of the loop a new class is created inside the same var-name: $stClass ???

I mean, if I have 10 reccords in table, this code generates me 10 classes at the saved mapfile.

in teory I was waiting this code will failed, cause I thougt that 'stClass' will have only the last class object.

but is not what happens. it's a trick of PHP or MapScript API?

thanks


Eduardo Patto Kanegae
http://www.consultoria.eti.br
UIN: 303747254

Treinamento em UMN MapServer - http://www.consultoria.eti.br/ptbr/?menuoption=mapserver
I Encontro Nacional de Usuários MapServer - http://mapserver.cttmar.univali.br/encontro2004
Projeto MapServer Brasil - http://mapserver.cttmar.univali.br

***Fim da Mensagem / End of Message ***







More information about the mapserver-users mailing list