<div dir="ltr">Hello,<div><br></div><div>Instead of:</div><div><br></div><div><pre style="white-space:pre-wrap">$oAirportsClass->label->set("size", 10);</pre><pre style="white-space:pre-wrap"><br></pre><pre style="white-space:pre-wrap">
do:</pre><pre style="white-space:pre-wrap"><br></pre><pre style="white-space:pre-wrap">$oAirportsClass->getLabel(0)->set("size", 10);</pre><pre><span style="white-space:pre-wrap"><br></span></pre><pre><span style="white-space:pre-wrap"><a href="http://mapserver.org/mapscript/php/phpmapscript.html#classobj">http://mapserver.org/mapscript/php/phpmapscript.html#classobj</a><br>
</span></pre><pre><span style="white-space:pre-wrap"><br></span></pre><pre style="white-space:pre-wrap">daryl</pre></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 21, 2013 at 12:48 PM, Michael McInnis <span dir="ltr"><<a href="mailto:mmcinnis59@msn.com" target="_blank">mmcinnis59@msn.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Dear mapservers!<br><br>My map fails to draw when I attempt to add labels from my labelitem "icao".<br><br>Any attempt at using the label objects causes failure. I think I need to create a label object<br>
somehow before I use set() but can't find any examples on line. <br><br>// The following occurs near the bottom of my php code snippet and is commented to allow a successful draw.<br><pre>$oAirportsClass->label->set("size", 10);</pre>
<br><br>Can someone point me to a working example of drawing labels for a layer?<br><br>Thanks<br><pre><br></pre><br><br>
<pre>// 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);
$oLayerAirports->set("status", MS_DEFAULT);
$oLayerAirports->set("labelitem", "icao");
//$oLayerAirports->set("classitem", "MyAirports");
$oLayerAirports->set("connection", "host=xxx 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");
//$oAirportsClass->label->set("size", 10);
//$oAirportsClass->label->color->setRGB(0,0,0);</pre>
<br><br>Michael McInnis
6033 44th Ave. N.E.
Seattle, WA 98115
<a href="tel:206%20517-4701" value="+12065174701" target="_blank">206 517-4701</a> </div></div>
<br>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br></blockquote></div><br></div>