[mapserver-users] Mixed Mapfile and Mapscript (php)
Erich Schroeder
erich at museum.state.il.us
Sun Jun 23 14:01:05 PDT 2002
Hi,
I'm trying to set up a php mapscript application in which I have a
standard bunch of base layers in a standard base file (these draw just
fine) but then I want to dynamically add additional point layers which are
based on what shapefiles are present. I was wondering if anyone has some
example code for what is needed for adding in and displaying a new layer?
I'm probably missing something simple that I will find right after I send
this, but the current code looks like:
$map = ms_newMapObj("base.map");
//find what files are present in the folder for a particular taxon
$AgesPresent = GetAges($Taxon);
//set some path stuff
$TaxonPath = "$FaunmapPath/data/$TaxonLower";
foreach ($AgesPresent as $key=>$age) {
$layer = ms_newLayerObj($map);
$layer->set(data,"data/$taxon/$age.shp");
$layer->set(name,$age);
$layer->set(type,"point");
$layer->set(classitem,"sitenum");
$layer->set(status,"MS_DEFAULT");
$class = ms_newClassObj($layer);
$class->set(name,strtoupper($age));
$class->set(symbol,"circle");
$class->set(size,7);
$class->set(color,"7 27 249");
}
$img = $map->draw();
$url = $img->saveWebImage(MS_PNG, 0, 0, 0);
printf("<img src=%s width=%d height=%d>\n", $url, $map->width,
$map->height);
It seems to correctly add the layers (numbering in 1-15 depending on the
taxon), but I'm not seeing it. I'm sure that there is something wrong with
the color setting, and I suppose I need a "draw" statement, but I don't
see a clear description in any of the documentation or examples I have
found so far.
Erich
--
---------------------------------------------------------------------
Erich Schroeder Phone: (217)785-0033
Curator, Information Technologies FAX: (217)785-2857
Illinois State Museum GIS Lab email:erich(at)illinois.state.museum
http://illinois.state.museum/
---------------------------------------------------------------------
More information about the MapServer-users
mailing list