<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#00B0F0;
font-weight:bold;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
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-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><b><span style="color:#00B0F0">Jeremy,<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="color:#00B0F0"><o:p> </o:p></span></b></p>
<p class="MsoNormal"><b><span style="color:#00B0F0">One thing to check is the column name in Postgres, as in “CLASS” vs “class” vs “Class”, etc. Needs to match. Check the same thing on EXPRESSION values.<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="color:#00B0F0"><o:p> </o:p></span></b></p>
<p class="MsoNormal"><b><span style="color:#00B0F0">bobb<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="color:#00B0F0"><o:p> </o:p></span></b></p>
<div>
<p class="MsoNormal"><span style="color:#00B0F0"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="color:#00B0F0">My machine - - - PW19-S295-C024<o:p></o:p></span></b></p>
</div>
<p class="MsoNormal"><b><span style="color:#00B0F0"><o:p> </o:p></span></b></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> MapServer-users <mapserver-users-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Jeremy JK<br>
<b>Sent:</b> Saturday, April 29, 2023 2:12 PM<br>
<b>To:</b> Jason Snyder <mapserver-users@lists.osgeo.org><br>
<b>Subject:</b> [MapServer-users] Database problem when using CLASSITEM<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="1" cellpadding="0" style="background:#E2F700;border:solid black 1.0pt">
<tbody>
<tr>
<td style="border:none;padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><strong><span style="font-family:"Calibri",sans-serif;color:#FF3333">Think Before You Click:
</span></strong><span style="color:#FF3333">This email originated <strong><span style="font-family:"Calibri",sans-serif">outside
</span></strong>our organization.</span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Hola <br>
<br>
OK so I am going through the MapServer tutorial <br>
Example 1-3 to be exact <br>
the one with the classes <br>
using classes to split layer polygon into land and water <br>
<br>
when shp and dbf file is in filesystem it works fine <br>
But <br>
When I import shp file into postgres I get the following error <br>
<br>
After checking the error logs, my question is how do I get a class column? Do I have to insert the dbf file into schema? If so, how?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks <br>
<br>
<b>Error</b>: <br>
msDrawMap(): Image handling error. Failed to draw layer named 'states_poly'. msPostGISLayerWhichShapes(): Query error. Error executing query. Check server logs<br>
<br>
<br>
<b>Query: <br>
</b><a href="http://localhost:8081/cgi-bin/mapserv?map=/opt/map/mdm60/example1-3.map&layer=states_poly&layer=states_line&mode=map">http://localhost:8081/cgi-bin/mapserv?map=/opt/map/mdm60/example1-3.map&layer=states_poly&layer=states_line&mode=map</a><br>
<br>
<br>
<b>Mapfile</b>:<br>
MAP<br>
IMAGETYPE PNG<br>
EXTENT -97.238976 41.619778 -82.122902 49.385620<br>
SIZE 400 300<br>
SHAPEPATH "/opt/map/mdm60/ms4w/apps/tutorial/data/"<br>
IMAGECOLOR 255 255 255<br>
<br>
LAYER <br>
NAME "states_poly"<br>
CONNECTIONTYPE POSTGIS<br>
CONNECTION "user=postgres password=postgres dbname=mdm6data host=mxsig-db port=5432"<br>
DATA "wkb_geometry from tutoiral.states_ugl_imported using srid=3857"<br>
STATUS OFF<br>
TYPE POLYGON<br>
<br>
CLASSITEM "CLASS"<br>
<br>
CLASS<br>
NAME 'States'<br>
EXPRESSION 'land' <br>
STYLE<br>
COLOR 232 232 232<br>
END<br>
END<br>
CLASS<br>
NAME 'Water'<br>
EXPRESSION 'water' <br>
STYLE<br>
COLOR 198 198 255<br>
END<br>
END<br>
END <br>
LAYER
<br>
NAME "states_line"<br>
CONNECTIONTYPE POSTGIS<br>
CONNECTION "user=postgres password=postgres dbname=mdm6data host=mxsig-db port=5432"<br>
DATA "wkb_geometry from tutorial.sttes_ugl_imported using srid=3875"<br>
STATUS OFF<br>
TYPE LINE<br>
<br>
CLASSITEM "CLASS"<br>
<br>
CLASS<br>
NAME 'State Boundary'<br>
EXPRESSION 'land'<br>
STYLE<br>
COLOR 32 32 32<br>
END<br>
END<br>
END <br>
<br>
<br>
END <br>
<br>
<b>Error Log:<br>
</b>[Sat Apr 29 19:08:42 2023].232185 CGI Request 1 on process 1677<br>
[Sat Apr 29 19:08:42 2023].233452 msDrawMap(): rendering using outputformat named png (AGG/PNG).<br>
[Sat Apr 29 19:08:42 2023].233473 msDrawMap(): WMS/WFS set-up and query, 0.000s<br>
[Sat Apr 29 19:08:42 2023].282742 msPostGISLayerWhichShapes(): Error (ERROR: no existe la columna «CLASS»<br>
LINE 1: select "CLASS"::text,ST_AsBinary(("wkb_geometry"),'NDR') as ...<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>