<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
MapServer now supports multiple labels per feature so perhaps it’s a reasonable addition. Will take a peek...
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Nicol Hermann <mapserver@geoworld.de><br>
<b>Sent:</b> Thursday, August 1, 2019 1:37:13 PM<br>
<b>To:</b> Lime, Steve D (MNIT) <steve.lime@state.mn.us>; mapserver-users@lists.osgeo.org <mapserver-users@lists.osgeo.org><br>
<b>Subject:</b> Re: [mapserver-users] labels for pie|bar charts</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This message may be from an external email source.<br>
Do not select links or open attachments unless verified. Report all suspicious emails to Minnesota IT Services Security Operations Center.<br>
<br>
<br>
<br>
Thanks Steve!<br>
Yes, correct. Labeling slices was not possible back then as well.<br>
The annotation layer was kind of a workaround.<br>
<br>
Will give it a try with your code snippet.<br>
<br>
Thanks<br>
Nicol<br>
<br>
<br>
Am Donnerstag, den 01.08.2019, 18:29 +0000 schrieb Lime, Steve D<br>
(MNIT):<br>
> You weren't labeling slices with PHP from the looks of it, just the<br>
> underlying feature using an annotation layer. So setting up a layer<br>
> to behave like an annotation layer is doable... Here's a simple<br>
> snippet for the state of Minnesota polygon:<br>
><br>
>   LAYER<br>
>     NAME bdry_statepy2<br>
>     STATUS DEFAULT<br>
>     TYPE POLYGON<br>
>     DATA ' bdry_statepy2'<br>
>     CLASS<br>
>       LABEL<br>
>         TEXT 'Minnesota'<br>
>         POSITION CC<br>
>         SIZE LARGE<br>
>         COLOR 0 0 0<br>
>       END<br>
>     END<br>
>   END<br>
><br>
> Basically using a class with no styles.<br>
><br>
> I don't recall the individual chart components (pies, bars, etc...)<br>
> as being labelable. It's not covered in the docs or the original RFC.<br>
> I will whip up a test case to confirm the behavior though.<br>
><br>
> --Steve<br>
><br>
> -----Original Message-----<br>
> From: Nicol Hermann [<a href="mailto:mapserver@geoworld.de">mailto:mapserver@geoworld.de</a>]<br>
> Sent: Thursday, August 01, 2019 12:33 PM<br>
> To: Lime, Steve D (MNIT) <steve.lime@state.mn.us>;<br>
> mapserver-users@lists.osgeo.org<br>
> Subject: Re: [mapserver-users] labels for pie|bar charts<br>
><br>
> This message may be from an external email source.<br>
> Do not select links or open attachments unless verified. Report all<br>
> suspicious emails to Minnesota IT Services Security Operations<br>
> Center.<br>
><br>
><br>
><br>
> Hello Steve,<br>
><br>
> you are right. With older versions of Mapserver I used 2 layers.<br>
> One for the chart (type=chart) and the other one to do the labeling<br>
> (type=annotation).<br>
> I used PHP Mapscript at that time. See the code snippet for the<br>
> annotation layer below. It uses the same data source like the<br>
> chartlayer.<br>
><br>
> $layer = ms_newLayerObj($Map);<br>
> $layer -> set('status', MS_ON);<br>
> $layer -> set('labelcache', MS_ON);<br>
> $layer -> set('type', MS_LAYER_ANNOTATION );<br>
> $layer -> set('data', $datapath);<br>
> $layer -> set('status', MS_ON);<br>
> $poClass = ms_newClassObj($layer);<br>
> $poClass-> set("name", "Beschrifung " );<br>
> $felder= '(';<br>
> foreach( $chartLayer['fieldlist'] as $feld ){<br>
>    $felder .= sprintf('%s = [%s]-', $feld, $feld);<br>
> }<br>
> $felder .=sprintf(')');<br>
> $poClass->settext($layer, "$felder");<br>
> $poClass-> label -> set('font', "arial");<br>
> $poClass-> label -> set('type', MS_TRUETYPE);<br>
> $poClass-> label -> set('size', 8);<br>
> $poClass-> label -> set('antialias', MS_TRUE);<br>
> $poClass-> label -> color -> setRGB ( 0, 0, 0 );<br>
> $poClass-> label -> set ('wrap', 0x2d); // use '-' to do a line break<br>
> $poClass-> label ->set('position', MS_AUTO);<br>
> $poClass-> label ->set('partials', MS_FALSE);<br>
> $poClass-> label ->backgroundcolor->setRGB('240','240','240');<br>
><br>
> Unfortunately this approach do not work anymore as the annotation<br>
> type<br>
> is not longer supported.<br>
><br>
> The MapFile which I am trying currently looks like this:<br>
><br>
>   LAYER<br>
>     DATA<br>
> "/home/nicol/public_html/geoworld/gw2_1und1/data/brd/media.shp"<br>
>     LABELITEM "NAME"<br>
>     NAME "Staedtecharts"<br>
>     PROJECTION<br>
>       "init=epsg:4326"<br>
>     END # PROJECTION<br>
>     STATUS DEFAULT<br>
>     TYPE CHART<br>
>     # PROCESSING "CHART_SIZE_RANGE=bevzahl"<br>
>     # PROCESSING "CHART_SIZE=130" # Fixe Groesse<br>
>     PROCESSING "CHART_TYPE=pie"  # pie, bar<br>
>     PROCESSING "CHART_SIZE_RANGE = itemname minsize maxsize minval<br>
> maxval exponent"<br>
>     PROCESSING "CHART_SIZE_RANGE=bevzahl 30 300 100000 2000000"<br>
>     LABELITEM "NAME"<br>
>     UNITS DD<br>
>     CLASS<br>
>       NAME "Maennlich"<br>
>       TEXT 'Hallo'<br>
>       LABEL<br>
>         FONT "arial"<br>
>         SIZE 30<br>
>         COLOR 255 0 0<br>
>         ENCODING "UTF-8"<br>
>         MINFEATURESIZE AUTO<br>
>         OFFSET 0 0<br>
>         POSITION AUTO<br>
>         SHADOWSIZE 1 1<br>
>       END # LABEL<br>
>       STYLE<br>
>         COLOR 192 192 192<br>
>         OUTLINECOLOR 0 0 0<br>
>         SIZE [mann]<br>
>       END # STYLE<br>
>     END # CLASS<br>
>     CLASS<br>
>       NAME "Weiblich"<br>
>       STYLE<br>
>         SIZE [frau]<br>
>         COLOR 255 255 0<br>
>         OUTLINECOLOR 0 0 0<br>
>       END<br>
>     END<br>
>   END # LAYER<br>
><br>
><br>
> My hope was that the chart type now also takes care of the labeling.<br>
><br>
> Any idea how to realize the labeling for the individual slices now?<br>
><br>
> Thanks<br>
> Nicol<br>
><br>
><br>
> Am Donnerstag, den 01.08.2019, 14:34 +0000 schrieb Lime, Steve D<br>
> (MNIT):<br>
> > Hi Nicol: Do you you have a sample mapfile that showed your<br>
> > approach?<br>
> > Since CHART and ANNOTATION are both layer types that implies<br>
> > multiple<br>
> > layers. --Steve<br>
> ><br>
> > -----Original Message-----<br>
> > From: mapserver-users [mailto:<br>
> > mapserver-users-bounces@lists.osgeo.org<br>
> > ] On Behalf Of Nicol Hermann<br>
> > Sent: Wednesday, July 31, 2019 2:52 PM<br>
> > To: mapserver-users@lists.osgeo.org<br>
> > Subject: [mapserver-users] labels for pie|bar charts<br>
> ><br>
> > This message may be from an external email source.<br>
> > Do not select links or open attachments unless verified. Report all<br>
> > suspicious emails to Minnesota IT Services Security Operations<br>
> > Center.<br>
> ><br>
> ><br>
> ><br>
> > Hello,<br>
> ><br>
> > I am trying to understand how labeling/annotation with layer type<br>
> > 'chart' for the individual slices e.g. of a PIE/BAR chart would<br>
> > work<br>
> > (<br>
> > <a href="https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Foutput%2Fdynamic_charting.html&amp;data=02%7C01%7Csteve.lime%40state.mn.us%7Ccace70b998234f92de2c08d716af1ff6%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C637002813718604608&amp;sdata=JvGoeC2vO3kV5lqINPV%2Fk%2B98er56HGVlKy2uQXVHKa0%3D&amp;reserved=0">
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Foutput%2Fdynamic_charting.html&amp;data=02%7C01%7Csteve.lime%40state.mn.us%7Ccace70b998234f92de2c08d716af1ff6%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C637002813718604608&amp;sdata=JvGoeC2vO3kV5lqINPV%2Fk%2B98er56HGVlKy2uQXVHKa0%3D&amp;reserved=0</a>).<br>
> > I have tried to set a LABELITEM on layer level, a LABEL block<br>
> > within<br>
> > the CLASS section, a TEXT property in the CLASS block but none of<br>
> > my<br>
> > attempts show any labels.<br>
> > In earlier versions of Mapserver I have used the ANNOTATION layer<br>
> > type<br>
> > to get labels but this type is now deprecated for 7.x versions.<br>
> > Any ideas?<br>
> > Thank you very much.<br>
> ><br>
> > Nicol<br>
> ><br>
> > _______________________________________________<br>
> > mapserver-users mailing list<br>
> > mapserver-users@lists.osgeo.org<br>
> > <a href="https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&amp;data=02%7C01%7Csteve.lime%40state.mn.us%7Ccace70b998234f92de2c08d716af1ff6%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C637002813718604608&amp;sdata=s2q0tY0kyxRSrOWxsAbjSsRo7WawWMPe2woZmTx0vZE%3D&amp;reserved=0">
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&amp;data=02%7C01%7Csteve.lime%40state.mn.us%7Ccace70b998234f92de2c08d716af1ff6%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C637002813718604608&amp;sdata=s2q0tY0kyxRSrOWxsAbjSsRo7WawWMPe2woZmTx0vZE%3D&amp;reserved=0</a><br>
<br>
</div>
</span></font></div>
</body>
</html>