[mapserver-users] Labels stopped working after update
Lime, Steve D (MNIT)
Steve.Lime at state.mn.us
Fri Sep 13 14:24:38 PDT 2013
Depends on how big of a jump in version you made. 6.2 now features multiple labels per class. I think you need to do something like:
$label = $oAirportsClass->getLabel(0);
$label->color->setRGB(0,0,0);
$label->set("font", "verdana");
$label->set("size", MS_LARGE);
$label->set("position", MS_AUTO);
$label->set("antialias", MS_TRUE);
Steve
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Michael McInnis
Sent: Friday, September 13, 2013 4:20 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Labels stopped working after update
This was working yesterday but I applied an update for ubuntu 12.04 today that had some mapserver items
and now my php file only works if I comment out the labels portion below so I get points without labels.
Did something change recently related to php mapscript labels?
// Layer 3 airports--------------------------------------------------------
// Point Symbol
$nSymbolId = ms_newSymbolObj($oMap, "circle");
$oSymbol = $oMap->getsymbolobjectbyid($nSymbolId);
$oSymbol->set("type", MS_SYMBOL_ELLIPSE);
$oSymbol->set("filled", MS_TRUE);
$aPoints[0] = 1;
$aPoints[1] = 1;
$oSymbol->setpoints($aPoints);
// Layer
$oLayerAirports = ms_newLayerObj($oMap);
$oLayerAirports->setConnectionType(MS_POSTGIS);
$oLayerAirports->set("name", "airports");
$oLayerAirports->set("type", MS_LAYER_POINT); # This is crucial
$oLayerAirports->set("status", MS_DEFAULT);
$oLayerAirports->set("labelitem", "icao");
//$oLayerAirports->set("classitem", "MyAirports");
$oLayerAirports->set("connection", "host=xxxx port=xxxx dbname=xxxx user=xxxx password=xxxx");
$oLayerAirports->set("data", "geom From (select a.icao, geom From airports a left join airportdata e on a.icao = e.icao where e.icao Is Not Null) as subquery using unique icao using srid=4326");
// Class with Labels
$oAirportsClass = ms_newClassObj($oLayerAirports);
$oAirportsClass->set("name","MyAirports");
// Style
$airportsStyle = ms_newStyleObj($oAirportsClass);
$airportsStyle->color->setRGB(255, 22, 22);
$airportsStyle->set("symbolname", "circle");
$airportsStyle->set("size", "3");
/* ONLY WORKS NOW IF THIS IS COMMENTED
// Label
$oAirportsClass->label->color->setRGB(0,0,0);
$oAirportsClass->label->set("font", "verdana");
$oAirportsClass->label->set("size", MS_LARGE);
$oAirportsClass->label->set("position", MS_AUTO);
$oAirportsClass->label->set("antialias", MS_TRUE);
*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130913/d1ea9876/attachment.htm>
More information about the MapServer-users
mailing list