[Mapserver-users] Can't display layer w/ php/mapscript
Wheaton, William D.
wdw at rti.org
Tue Mar 16 12:09:45 PST 2004
This is probably something pretty simple (I hope). I'm just trying to
create a class and style using php/mapscript rather than relying on the map
file...Eventually, I need to generate 60 classes and so I want to do it with
some code rather than putting all that in a .map file. But, I can't get
over the very first hurdle. I have a class and style in the map file, but I
want to either eliminate it or just override it in the script.
Here's the relevent part of the map file:
LAYER
PROJECTION
"proj=latlong"
"ellps=clrk66"
END
CONNECTIONTYPE postgis
NAME "Respondents"
GROUP "Base Data"
CONNECTION "user=xxx dbname=xxx password=xxxx"
DATA "the_geom from resp"
STATUS ON
TYPE POINT
METADATA
LYRNAME "Respondents"
END
CLASS
STYLE
COLOR -1 -1 -1
END
END
END
And here's the code from the script:
$layer = $map->getlayerbyname('Respondents');
$class = ms_newClassObj($layer);
$style = ms_newStyleObj($class);
$style->set("symbolname", "field_interviewer");
$style->set("size", 4);
$style->color->setRGB(0, 255, 0);
$class->set("status", "MS_ON");
$layer->set("status", MS_ON);
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);
Other layers (that are in the map file, but that aren't handled in
php/mapscript) show up, but this one doesn't. Thanks in advance for any
advice!
Bill
More information about the MapServer-users
mailing list