<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoPlainText>I am now using a case statement/switch within the SQL since the data is in a PostGis table. I am not sure if it is possible to use SQL to return a subset of data from a Shapefile in Mapserver. If it is then the following may help. It would be neat if the calculation ‘CASE’ could be done within the LABEL/POSITION.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText># POSITION <o:p></o:p></p><p class=MsoPlainText>#<o:p></o:p></p><p class=MsoPlainText># The anchorposition is as follows in the CartographicText table:<o:p></o:p></p><p class=MsoPlainText>#<o:p></o:p></p><p class=MsoPlainText># 2 5 8<o:p></o:p></p><p class=MsoPlainText># 1 4 7<o:p></o:p></p><p class=MsoPlainText># 0 3 6<o:p></o:p></p><p class=MsoPlainText>#<o:p></o:p></p><p class=MsoPlainText># Corresponding MapServer positions<o:p></o:p></p><p class=MsoPlainText>#<o:p></o:p></p><p class=MsoPlainText># ul uc ur<o:p></o:p></p><p class=MsoPlainText># cl cc cr<o:p></o:p></p><p class=MsoPlainText># ll lc lr<o:p></o:p></p><p class=MsoPlainText>#<o:p></o:p></p><p class=MsoPlainText># Corresponding OpenLayers positions<o:p></o:p></p><p class=MsoPlainText>#<o:p></o:p></p><p class=MsoPlainText># lt ct rt<o:p></o:p></p><p class=MsoPlainText># lm cm rm<o:p></o:p></p><p class=MsoPlainText># lb cb rb<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText># fontnumber<o:p></o:p></p><p class=MsoPlainText># 0 - Lutheran (used for non-Roman antiquities)<o:p></o:p></p><p class=MsoPlainText># 1 - Normal - Medium Roman font<o:p></o:p></p><p class=MsoPlainText># 2 - Light Roman font (used primarily for building numbers, Roman antiquities, and some administrative names particularly in 1:10 000 areas)<o:p></o:p></p><p class=MsoPlainText># 3 - Suppressed text not supplied in Land-Line due to space limitations.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText># textstyle<o:p></o:p></p><p class=MsoPlainText># 0 - Normal<o:p></o:p></p><p class=MsoPlainText># 1 - Italics<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText># Mapserver ANGLE is anticlockwise<o:p></o:p></p><p class=MsoPlainText># MasterMap orientation is measured in tenths of a degree anticlockwise from due east (0-3599)<o:p></o:p></p><p class=MsoPlainText># For clockwise, ANGLE can be changed thus (360-ANGLE)<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>DATA "geom FROM (SELECT toid, featurecode, textstring, height, orientation/10 AS orientation, ('x'||substring(col,1,2))::text::bit(8)::int || ' ' || ('x'||substring(col,3,2))::text::bit(8)::int || ' ' || ('x'||substring(col,1,2))::text::bit(8)::int AS oscolor, CASE WHEN fontnumber = 0 AND textstyle = 0 THEN 'BlackCastleMF' WHEN fontnumber = 0 AND textstyle = 1 THEN 'BlackCastleMF' WHEN fontnumber = 1 AND textstyle = 0 THEN 'arial' WHEN fontnumber = 1 AND textstyle = 1 THEN 'arialitalic' WHEN fontnumber = 2 AND textstyle = 0 THEN 'arial' WHEN fontnumber = 2 AND textstyle = 1 THEN 'arialitalic' ELSE 'arial' END AS font, CASE WHEN anchorposition=0 THEN 'ur' WHEN anchorposition=1 THEN 'cr' WHEN anchorposition=2 THEN 'lr' WHEN anchorposition=3 THEN 'uc' WHEN anchorposition=4 THEN 'cc' WHEN anchorposition=5 THEN 'lc' WHEN anchorposition=6 THEN 'ul' WHEN anchorposition=7 THEN 'cl' WHEN anchorposition=8 THEN 'll' ELSE 'auto' END AS anchorpositiontxt, geom FROM cartographictext) AS foo USING UNIQUE toid"<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Regards,<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Donald<o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB'> mapserver-users-bounces@lists.osgeo.org [mailto:mapserver-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>Schylberg Lars<br><b>Sent:</b> 12 September 2013 07:53<br><b>To:</b> mapserver-users@lists.osgeo.org<br><b>Subject:</b> [mapserver-users] anchor label positions<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>Hello,<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>I have read the following discussion below but have not found out if anything has happened since then.<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US><a href="http://lists.osgeo.org/pipermail/mapserver-users/2008-December/059123.html">http://lists.osgeo.org/pipermail/mapserver-users/2008-December/059123.html</a><o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=SV><a href="http://lists.osgeo.org/pipermail/mapserver-users/2010-November/067312.html"><span lang=EN-US>http://lists.osgeo.org/pipermail/mapserver-users/2010-November/067312.html</span></a></span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>I have shape files with anchor point positions:<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>7 8 9<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>4 5 6<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>1 2 3<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>That corresponds:<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>ul uc ur <o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>cl cc cr <o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>ll lc lr<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>I wrote my mapfile as shown below. Is there a more simple and shorter way to express this today?<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>TJUST variable is the POSITION expressed as a integer between 1 and 9 in my shape files<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>If there is no way to do this, could I remap the shape file with ogr2ogr to add an extra column in the table with mapserver positions?<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:10.0pt;line-height:115%'><span lang=EN-US>/Lars<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'>LAYER<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> NAME 'LAKESNAMES'<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TYPE POINT<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> GROUP 'default'<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> PROJECTION<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> 'init=epsg:32633'<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> STATUS ON<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> SIZEUNITS PIXELS<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> DATA 'sve1milj_32633/tx_riks'<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> CLASSITEM KKOD<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> CLASS<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> NAME "TextLake5"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> EXPRESSION /87|86/ <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> LABEL<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> EXPRESSION ([TJUST] = 7)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> SIZE 8<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> FONT 'sc' <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TYPE truetype<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> POSITION ul<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> ANGLE [TRIKT]<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> COLOR 0 0 0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TEXT '[TEXT]'<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> LABEL<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> EXPRESSION ([TJUST] = 8)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> SIZE 8<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> FONT 'sc' <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TYPE truetype<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> POSITION uc<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> ANGLE [TRIKT]<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> COLOR 0 0 0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TEXT "[TEXT]"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> LABEL<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> EXPRESSION ([TJUST] = 9)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> SIZE 8<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> FONT 'sc' <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TYPE truetype<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> POSITION ur<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> ANGLE [TRIKT]<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> COLOR 0 0 0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TEXT "[TEXT]"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> LABEL<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> EXPRESSION ([TJUST] = 4)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> SIZE 8<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> FONT 'sc' <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TYPE truetype<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> POSITION cl<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> ANGLE [TRIKT]<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> COLOR 0 0 0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TEXT "[TEXT]"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> LABEL<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> EXPRESSION ([TJUST] = 5)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> SIZE 8<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> FONT 'sc' <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TYPE truetype<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> POSITION cc<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> ANGLE [TRIKT]<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> COLOR 0 0 0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> TEXT "[TEXT]"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> LABEL<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'> EXPRESSION ([TJUST] = 6)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'>... and 5 more expressions in the same way.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:SV'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>