Re: [mapserver-users] labels for pie|bar charts

2019-08-01 Thread Lime, Steve D (MNIT)
MapServer now supports multiple labels per feature so perhaps it’s a reasonable 
addition. Will take a peek...

From: Nicol Hermann 
Sent: Thursday, August 1, 2019 1:37:13 PM
To: Lime, Steve D (MNIT) ; 
mapserver-users@lists.osgeo.org 
Subject: Re: [mapserver-users] labels for pie|bar charts

This message may be from an external email source.
Do not select links or open attachments unless verified. Report all suspicious 
emails to Minnesota IT Services Security Operations Center.



Thanks Steve!
Yes, correct. Labeling slices was not possible back then as well.
The annotation layer was kind of a workaround.

Will give it a try with your code snippet.

Thanks
Nicol


Am Donnerstag, den 01.08.2019, 18:29 + schrieb Lime, Steve D
(MNIT):
> You weren't labeling slices with PHP from the looks of it, just the
> underlying feature using an annotation layer. So setting up a layer
> to behave like an annotation layer is doable... Here's a simple
> snippet for the state of Minnesota polygon:
>
>   LAYER
> NAME bdry_statepy2
> STATUS DEFAULT
> TYPE POLYGON
> DATA ' bdry_statepy2'
> CLASS
>   LABEL
> TEXT 'Minnesota'
> POSITION CC
> SIZE LARGE
> COLOR 0 0 0
>   END
> END
>   END
>
> Basically using a class with no styles.
>
> I don't recall the individual chart components (pies, bars, etc...)
> as being labelable. It's not covered in the docs or the original RFC.
> I will whip up a test case to confirm the behavior though.
>
> --Steve
>
> -Original Message-
> From: Nicol Hermann [mailto:mapser...@geoworld.de]
> Sent: Thursday, August 01, 2019 12:33 PM
> To: Lime, Steve D (MNIT) ;
> mapserver-users@lists.osgeo.org
> Subject: Re: [mapserver-users] labels for pie|bar charts
>
> This message may be from an external email source.
> Do not select links or open attachments unless verified. Report all
> suspicious emails to Minnesota IT Services Security Operations
> Center.
>
>
>
> Hello Steve,
>
> you are right. With older versions of Mapserver I used 2 layers.
> One for the chart (type=chart) and the other one to do the labeling
> (type=annotation).
> I used PHP Mapscript at that time. See the code snippet for the
> annotation layer below. It uses the same data source like the
> chartlayer.
>
> $layer = ms_newLayerObj($Map);
> $layer -> set('status', MS_ON);
> $layer -> set('labelcache', MS_ON);
> $layer -> set('type', MS_LAYER_ANNOTATION );
> $layer -> set('data', $datapath);
> $layer -> set('status', MS_ON);
> $poClass = ms_newClassObj($layer);
> $poClass-> set("name", "Beschrifung " );
> $felder= '(';
> foreach( $chartLayer['fieldlist'] as $feld ){
>$felder .= sprintf('%s = [%s]-', $feld, $feld);
> }
> $felder .=sprintf(')');
> $poClass->settext($layer, "$felder");
> $poClass-> label -> set('font', "arial");
> $poClass-> label -> set('type', MS_TRUETYPE);
> $poClass-> label -> set('size', 8);
> $poClass-> label -> set('antialias', MS_TRUE);
> $poClass-> label -> color -> setRGB ( 0, 0, 0 );
> $poClass-> label -> set ('wrap', 0x2d); // use '-' to do a line break
> $poClass-> label ->set('position', MS_AUTO);
> $poClass-> label ->set('partials', MS_FALSE);
> $poClass-> label ->backgroundcolor->setRGB('240','240','240');
>
> Unfortunately this approach do not work anymore as the annotation
> type
> is not longer supported.
>
> The MapFile which I am trying currently looks like this:
>
>   LAYER
> DATA
> "/home/nicol/public_html/geoworld/gw2_1und1/data/brd/media.shp"
> LABELITEM "NAME"
> NAME "Staedtecharts"
> PROJECTION
>   "init=epsg:4326"
> END # PROJECTION
> STATUS DEFAULT
> TYPE CHART
> # PROCESSING "CHART_SIZE_RANGE=bevzahl"
> # PROCESSING "CHART_SIZE=130" # Fixe Groesse
> PROCESSING "CHART_TYPE=pie"  # pie, bar
> PROCESSING "CHART_SIZE_RANGE = itemname minsize maxsize minval
> maxval exponent"
> PROCESSING "CHART_SIZE_RANGE=bevzahl 30 300 10 200"
> LABELITEM "NAME"
> UNITS DD
> CLASS
>   NAME "Maennlich"
>   TEXT 'Hallo'
>   LABEL
> FONT "arial"
> SIZE 30
> COLOR 255 0 0
> ENCODING "UTF-8&qu

Re: [mapserver-users] labels for pie|bar charts

2019-08-01 Thread Nicol Hermann
Thanks Steve!
Yes, correct. Labeling slices was not possible back then as well.
The annotation layer was kind of a workaround.

Will give it a try with your code snippet.

Thanks
Nicol


Am Donnerstag, den 01.08.2019, 18:29 + schrieb Lime, Steve D
(MNIT):
> You weren't labeling slices with PHP from the looks of it, just the
> underlying feature using an annotation layer. So setting up a layer
> to behave like an annotation layer is doable... Here's a simple
> snippet for the state of Minnesota polygon:
> 
>   LAYER
> NAME bdry_statepy2
> STATUS DEFAULT
> TYPE POLYGON
> DATA ' bdry_statepy2'
> CLASS
>   LABEL
> TEXT 'Minnesota'
> POSITION CC
> SIZE LARGE
> COLOR 0 0 0
>   END
> END
>   END
> 
> Basically using a class with no styles.
> 
> I don't recall the individual chart components (pies, bars, etc...)
> as being labelable. It's not covered in the docs or the original RFC.
> I will whip up a test case to confirm the behavior though.
> 
> --Steve
> 
> -Original Message-
> From: Nicol Hermann [mailto:mapser...@geoworld.de] 
> Sent: Thursday, August 01, 2019 12:33 PM
> To: Lime, Steve D (MNIT) ; 
> mapserver-users@lists.osgeo.org
> Subject: Re: [mapserver-users] labels for pie|bar charts
> 
> This message may be from an external email source.
> Do not select links or open attachments unless verified. Report all
> suspicious emails to Minnesota IT Services Security Operations
> Center.
> 
> 
> 
> Hello Steve,
> 
> you are right. With older versions of Mapserver I used 2 layers.
> One for the chart (type=chart) and the other one to do the labeling
> (type=annotation).
> I used PHP Mapscript at that time. See the code snippet for the
> annotation layer below. It uses the same data source like the
> chartlayer.
> 
> $layer = ms_newLayerObj($Map);
> $layer -> set('status', MS_ON);
> $layer -> set('labelcache', MS_ON);
> $layer -> set('type', MS_LAYER_ANNOTATION );
> $layer -> set('data', $datapath);
> $layer -> set('status', MS_ON);
> $poClass = ms_newClassObj($layer);
> $poClass-> set("name", "Beschrifung " );
> $felder= '(';
> foreach( $chartLayer['fieldlist'] as $feld ){
>$felder .= sprintf('%s = [%s]-', $feld, $feld);
> }
> $felder .=sprintf(')');
> $poClass->settext($layer, "$felder");
> $poClass-> label -> set('font', "arial");
> $poClass-> label -> set('type', MS_TRUETYPE);
> $poClass-> label -> set('size', 8);
> $poClass-> label -> set('antialias', MS_TRUE);
> $poClass-> label -> color -> setRGB ( 0, 0, 0 );
> $poClass-> label -> set ('wrap', 0x2d); // use '-' to do a line break
> $poClass-> label ->set('position', MS_AUTO);
> $poClass-> label ->set('partials', MS_FALSE);
> $poClass-> label ->backgroundcolor->setRGB('240','240','240');
> 
> Unfortunately this approach do not work anymore as the annotation
> type
> is not longer supported.
> 
> The MapFile which I am trying currently looks like this:
> 
>   LAYER
> DATA
> "/home/nicol/public_html/geoworld/gw2_1und1/data/brd/media.shp"
> LABELITEM "NAME"
> NAME "Staedtecharts"
> PROJECTION
>   "init=epsg:4326"
> END # PROJECTION
> STATUS DEFAULT
> TYPE CHART
> # PROCESSING "CHART_SIZE_RANGE=bevzahl"
> # PROCESSING "CHART_SIZE=130" # Fixe Groesse
> PROCESSING "CHART_TYPE=pie"  # pie, bar
> PROCESSING "CHART_SIZE_RANGE = itemname minsize maxsize minval
> maxval exponent"
> PROCESSING "CHART_SIZE_RANGE=bevzahl 30 300 10 200"
> LABELITEM "NAME"
> UNITS DD
> CLASS
>   NAME "Maennlich"
>   TEXT 'Hallo'
>   LABEL
> FONT "arial"
> SIZE 30
> COLOR 255 0 0
> ENCODING "UTF-8"
> MINFEATURESIZE AUTO
> OFFSET 0 0
> POSITION AUTO
> SHADOWSIZE 1 1
>   END # LABEL
>   STYLE
> COLOR 192 192 192
> OUTLINECOLOR 0 0 0
> SIZE [mann]
>   END # STYLE
> END # CLASS
>     CLASS
>   NAME "Weiblich"
>   STYLE
> SIZE [frau]
> COLOR 255 255 0
> OUTLINECOLOR 0 0 0
>   END
> END
>   END # LAYER
> 
> 

Re: [mapserver-users] labels for pie|bar charts

2019-08-01 Thread Lime, Steve D (MNIT)
You weren't labeling slices with PHP from the looks of it, just the underlying 
feature using an annotation layer. So setting up a layer to behave like an 
annotation layer is doable... Here's a simple snippet for the state of 
Minnesota polygon:

  LAYER
NAME bdry_statepy2
STATUS DEFAULT
TYPE POLYGON
DATA ' bdry_statepy2'
CLASS
  LABEL
TEXT 'Minnesota'
POSITION CC
SIZE LARGE
COLOR 0 0 0
  END
END
  END

Basically using a class with no styles.

I don't recall the individual chart components (pies, bars, etc...) as being 
labelable. It's not covered in the docs or the original RFC. I will whip up a 
test case to confirm the behavior though.

--Steve

-Original Message-
From: Nicol Hermann [mailto:mapser...@geoworld.de] 
Sent: Thursday, August 01, 2019 12:33 PM
To: Lime, Steve D (MNIT) ; 
mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] labels for pie|bar charts

This message may be from an external email source.
Do not select links or open attachments unless verified. Report all suspicious 
emails to Minnesota IT Services Security Operations Center.



Hello Steve,

you are right. With older versions of Mapserver I used 2 layers.
One for the chart (type=chart) and the other one to do the labeling
(type=annotation).
I used PHP Mapscript at that time. See the code snippet for the
annotation layer below. It uses the same data source like the chartlayer.

$layer = ms_newLayerObj($Map);
$layer -> set('status', MS_ON);
$layer -> set('labelcache', MS_ON);
$layer -> set('type', MS_LAYER_ANNOTATION );
$layer -> set('data', $datapath);
$layer -> set('status', MS_ON);
$poClass = ms_newClassObj($layer);
$poClass-> set("name", "Beschrifung " );
$felder= '(';
foreach( $chartLayer['fieldlist'] as $feld ){
   $felder .= sprintf('%s = [%s]-', $feld, $feld);
}
$felder .=sprintf(')');
$poClass->settext($layer, "$felder");
$poClass-> label -> set('font', "arial");
$poClass-> label -> set('type', MS_TRUETYPE);
$poClass-> label -> set('size', 8);
$poClass-> label -> set('antialias', MS_TRUE);
$poClass-> label -> color -> setRGB ( 0, 0, 0 );
$poClass-> label -> set ('wrap', 0x2d); // use '-' to do a line break
$poClass-> label ->set('position', MS_AUTO);
$poClass-> label ->set('partials', MS_FALSE);
$poClass-> label ->backgroundcolor->setRGB('240','240','240');

Unfortunately this approach do not work anymore as the annotation type
is not longer supported.

The MapFile which I am trying currently looks like this:

  LAYER
DATA
"/home/nicol/public_html/geoworld/gw2_1und1/data/brd/media.shp"
LABELITEM "NAME"
NAME "Staedtecharts"
PROJECTION
  "init=epsg:4326"
END # PROJECTION
STATUS DEFAULT
TYPE CHART
# PROCESSING "CHART_SIZE_RANGE=bevzahl"
# PROCESSING "CHART_SIZE=130" # Fixe Groesse
PROCESSING "CHART_TYPE=pie"  # pie, bar
PROCESSING "CHART_SIZE_RANGE = itemname minsize maxsize minval
maxval exponent"
PROCESSING "CHART_SIZE_RANGE=bevzahl 30 300 10 200"
LABELITEM "NAME"
UNITS DD
CLASS
  NAME "Maennlich"
  TEXT 'Hallo'
  LABEL
FONT "arial"
SIZE 30
COLOR 255 0 0
ENCODING "UTF-8"
MINFEATURESIZE AUTO
OFFSET 0 0
POSITION AUTO
SHADOWSIZE 1 1
  END # LABEL
  STYLE
COLOR 192 192 192
OUTLINECOLOR 0 0 0
SIZE [mann]
  END # STYLE
END # CLASS
CLASS
  NAME "Weiblich"
  STYLE
SIZE [frau]
COLOR 255 255 0
OUTLINECOLOR 0 0 0
  END
END
  END # LAYER


My hope was that the chart type now also takes care of the labeling.

Any idea how to realize the labeling for the individual slices now?

Thanks
Nicol


Am Donnerstag, den 01.08.2019, 14:34 + schrieb Lime, Steve D
(MNIT):
> Hi Nicol: Do you you have a sample mapfile that showed your approach?
> Since CHART and ANNOTATION are both layer types that implies multiple
> layers. --Steve
>
> -Original Message-
> From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org
> ] On Behalf Of Nicol Hermann
> Sent: Wednesday, July 31, 2019 2:52 PM
> To: mapserver-users@lists.osgeo.org
> Subject: [mapserver-users] labels for pie|bar charts
>
> This message may be from an external email source.
> Do not select links or open attachments unless verified. Report all
> suspicious emails to Minnesota IT Services Security Operations
> Cent

Re: [mapserver-users] labels for pie|bar charts

2019-08-01 Thread Nicol Hermann
Hello Steve,

you are right. With older versions of Mapserver I used 2 layers.
One for the chart (type=chart) and the other one to do the labeling
(type=annotation).
I used PHP Mapscript at that time. See the code snippet for the
annotation layer below. It uses the same data source like the chartlayer. 

$layer = ms_newLayerObj($Map);
$layer -> set('status', MS_ON);
$layer -> set('labelcache', MS_ON);
$layer -> set('type', MS_LAYER_ANNOTATION );
$layer -> set('data', $datapath);
$layer -> set('status', MS_ON);
$poClass = ms_newClassObj($layer);
$poClass-> set("name", "Beschrifung " );
$felder= '(';
foreach( $chartLayer['fieldlist'] as $feld ){
   $felder .= sprintf('%s = [%s]-', $feld, $feld); 
}
$felder .=sprintf(')');
$poClass->settext($layer, "$felder");
$poClass-> label -> set('font', "arial");
$poClass-> label -> set('type', MS_TRUETYPE);
$poClass-> label -> set('size', 8);
$poClass-> label -> set('antialias', MS_TRUE);
$poClass-> label -> color -> setRGB ( 0, 0, 0 );
$poClass-> label -> set ('wrap', 0x2d); // use '-' to do a line break
$poClass-> label ->set('position', MS_AUTO);
$poClass-> label ->set('partials', MS_FALSE);
$poClass-> label ->backgroundcolor->setRGB('240','240','240');

Unfortunately this approach do not work anymore as the annotation type
is not longer supported.

The MapFile which I am trying currently looks like this:

  LAYER
DATA
"/home/nicol/public_html/geoworld/gw2_1und1/data/brd/media.shp"
LABELITEM "NAME"
NAME "Staedtecharts"
PROJECTION
  "init=epsg:4326"
END # PROJECTION
STATUS DEFAULT 
TYPE CHART
# PROCESSING "CHART_SIZE_RANGE=bevzahl"
# PROCESSING "CHART_SIZE=130" # Fixe Groesse
PROCESSING "CHART_TYPE=pie"  # pie, bar
PROCESSING "CHART_SIZE_RANGE = itemname minsize maxsize minval
maxval exponent"
PROCESSING "CHART_SIZE_RANGE=bevzahl 30 300 10 200"
LABELITEM "NAME"
UNITS DD 
CLASS
  NAME "Maennlich"
  TEXT 'Hallo'
  LABEL
FONT "arial"
SIZE 30
COLOR 255 0 0
ENCODING "UTF-8"
MINFEATURESIZE AUTO
OFFSET 0 0
POSITION AUTO
SHADOWSIZE 1 1
  END # LABEL
  STYLE
COLOR 192 192 192
OUTLINECOLOR 0 0 0
SIZE [mann]
  END # STYLE
END # CLASS
CLASS
  NAME "Weiblich"
  STYLE
SIZE [frau]
COLOR 255 255 0
OUTLINECOLOR 0 0 0
  END
END
  END # LAYER


My hope was that the chart type now also takes care of the labeling.

Any idea how to realize the labeling for the individual slices now?

Thanks
Nicol


Am Donnerstag, den 01.08.2019, 14:34 + schrieb Lime, Steve D
(MNIT):
> Hi Nicol: Do you you have a sample mapfile that showed your approach?
> Since CHART and ANNOTATION are both layer types that implies multiple
> layers. --Steve
> 
> -Original Message-
> From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org
> ] On Behalf Of Nicol Hermann
> Sent: Wednesday, July 31, 2019 2:52 PM
> To: mapserver-users@lists.osgeo.org
> Subject: [mapserver-users] labels for pie|bar charts
> 
> This message may be from an external email source.
> Do not select links or open attachments unless verified. Report all
> suspicious emails to Minnesota IT Services Security Operations
> Center.
> 
> 
> 
> Hello,
> 
> I am trying to understand how labeling/annotation with layer type
> 'chart' for the individual slices e.g. of a PIE/BAR chart would work
> (
> https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Foutput%2Fdynamic_charting.html&data=02%7C01%7Csteve.lime%40state.mn.us%7C6232218953ac431b0e4c08d715f1180f%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C637001997557352724&sdata=ZFkZ8QsEuUaAGFyFIxfZjWK9XR8QeyDBv390t2p%2F23o%3D&reserved=0).
> I have tried to set a LABELITEM on layer level, a LABEL block within
> the CLASS section, a TEXT property in the CLASS block but none of my
> attempts show any labels.
> In earlier versions of Mapserver I have used the ANNOTATION layer
> type
> to get labels but this type is now deprecated for 7.x versions.
> Any ideas?
> Thank you very much.
> 
> Nicol
> 
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&data=02%7C01%7Csteve.lime%40state.mn.us%7C6232218953ac431b0e4c08d715f1180f%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C637001997557352724&sdata=dceZhhKxeZLbr717UmidG4ujIcnThwm7mlU5bIoGfBQ%3D&reserved=0

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] labels for pie|bar charts

2019-08-01 Thread Lime, Steve D (MNIT)
Hi Nicol: Do you you have a sample mapfile that showed your approach? Since 
CHART and ANNOTATION are both layer types that implies multiple layers. --Steve

-Original Message-
From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On 
Behalf Of Nicol Hermann
Sent: Wednesday, July 31, 2019 2:52 PM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] labels for pie|bar charts

This message may be from an external email source.
Do not select links or open attachments unless verified. Report all suspicious 
emails to Minnesota IT Services Security Operations Center.



Hello,

I am trying to understand how labeling/annotation with layer type
'chart' for the individual slices e.g. of a PIE/BAR chart would work (
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Foutput%2Fdynamic_charting.html&data=02%7C01%7Csteve.lime%40state.mn.us%7C6232218953ac431b0e4c08d715f1180f%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C637001997557352724&sdata=ZFkZ8QsEuUaAGFyFIxfZjWK9XR8QeyDBv390t2p%2F23o%3D&reserved=0).
I have tried to set a LABELITEM on layer level, a LABEL block within
the CLASS section, a TEXT property in the CLASS block but none of my
attempts show any labels.
In earlier versions of Mapserver I have used the ANNOTATION layer type
to get labels but this type is now deprecated for 7.x versions.
Any ideas?
Thank you very much.

Nicol

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&data=02%7C01%7Csteve.lime%40state.mn.us%7C6232218953ac431b0e4c08d715f1180f%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C637001997557352724&sdata=dceZhhKxeZLbr717UmidG4ujIcnThwm7mlU5bIoGfBQ%3D&reserved=0
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

[mapserver-users] labels for pie|bar charts

2019-07-31 Thread Nicol Hermann
Hello,

I am trying to understand how labeling/annotation with layer type
'chart' for the individual slices e.g. of a PIE/BAR chart would work (
https://mapserver.org/output/dynamic_charting.html).
I have tried to set a LABELITEM on layer level, a LABEL block within
the CLASS section, a TEXT property in the CLASS block but none of my
attempts show any labels.
In earlier versions of Mapserver I have used the ANNOTATION layer type
to get labels but this type is now deprecated for 7.x versions.
Any ideas?
Thank you very much.

Nicol

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users