<div dir="auto">Try "class" lower case. Be sure that the case of your column names match the case in postges. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 30, 2023, 3:04 PM Jeremy JK <<a href="mailto:jason2017jay@gmail.com">jason2017jay@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jeff,<div>My understanding, as the tutorial says, is that the class column comes from the dbf file <br>That's the tutorial's dataset - shp file and dbf file</div><div>So I guess my query will be how to import the dbf file into the database such that is "corresponds" to the shp file table </div><div><br></div><div>How to import states_ugl.dbf together with states_ugl.shp? </div><div><br></div><div>I guess this is more of a problem with handling a specific data set for a specific purpose (tutorial data for the tutorial) </div><div><br></div><div>I will practice using files </div><div>But would be good to know how to insert the 2 different types of files "simultaneously" for future reference </div><div><br></div><div><br></div><div><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"> <div><br></div><div><br></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 30, 2023 at 3:00 PM <<a href="mailto:mapserver-users-request@lists.osgeo.org" target="_blank" rel="noreferrer">mapserver-users-request@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send MapServer-users mailing list submissions to<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank" rel="noreferrer">mapserver-users@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:mapserver-users-request@lists.osgeo.org" target="_blank" rel="noreferrer">mapserver-users-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:mapserver-users-owner@lists.osgeo.org" target="_blank" rel="noreferrer">mapserver-users-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of MapServer-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Database problem when using CLASSITEM (Jeremy JK)<br>
2. Re: Database problem when using CLASSITEM (Jeff McKenna)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sat, 29 Apr 2023 15:12:26 -0400<br>
From: Jeremy JK <<a href="mailto:jason2017jay@gmail.com" target="_blank" rel="noreferrer">jason2017jay@gmail.com</a>><br>
To: Jason Snyder <<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank" rel="noreferrer">mapserver-users@lists.osgeo.org</a>><br>
Subject: [MapServer-users] Database problem when using CLASSITEM<br>
Message-ID:<br>
<CAKjBGf+iN=mw+F9=<a href="mailto:fODiXGr6rYnaSKbPV9wxrNAF_-M2-pB%2Bew@mail.gmail.com" target="_blank" rel="noreferrer">fODiXGr6rYnaSKbPV9wxrNAF_-M2-pB+ew@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
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?<br>
Do I have to insert the dbf file into schema? If so, how?<br>
Thanks<br>
<br>
*Error*:<br>
msDrawMap(): Image handling error. Failed to draw layer named<br>
'states_poly'. msPostGISLayerWhichShapes(): Query error. Error executing<br>
query. Check server logs<br>
<br>
<br>
<br>
*Query: *<br>
<a href="http://localhost:8081/cgi-bin/mapserv?map=/opt/map/mdm60/example1-3.map&layer=states_poly&layer=states_line&mode=map" rel="noreferrer noreferrer" target="_blank">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>
*Mapfile*:<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<br>
host=mxsig-db port=5432"<br>
DATA "wkb_geometry from tutoiral.states_ugl_imported using<br>
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>
<br>
LAYER<br>
NAME "states_line"<br>
CONNECTIONTYPE POSTGIS<br>
CONNECTION "user=postgres password=postgres dbname=mdm6data<br>
host=mxsig-db port=5432"<br>
DATA "wkb_geometry from tutorial.sttes_ugl_imported using<br>
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>
<br>
*Error Log:*[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<br>
named png (AGG/PNG).<br>
[Sat Apr 29 19:08:42 2023].233473 msDrawMap(): WMS/WFS set-up and query,<br>
0.000s<br>
[Sat Apr 29 19:08:42 2023].282742 msPostGISLayerWhichShapes(): Error<br>
(ERROR: no existe la columna ?CLASS?<br>
LINE 1: select "CLASS"::text,ST_AsBinary(("wkb_geometry"),'NDR') as ...<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230429/f3df399b/attachment-0001.htm" rel="noreferrer noreferrer" target="_blank">http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230429/f3df399b/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sun, 30 Apr 2023 14:56:45 -0300<br>
From: Jeff McKenna <<a href="mailto:jmckenna@gatewaygeomatics.com" target="_blank" rel="noreferrer">jmckenna@gatewaygeomatics.com</a>><br>
To: <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank" rel="noreferrer">mapserver-users@lists.osgeo.org</a><br>
Subject: Re: [MapServer-users] Database problem when using CLASSITEM<br>
Message-ID:<br>
<<a href="mailto:8e6a0d0c-34aa-fe09-698a-6c815d9b3ef2@gatewaygeomatics.com" target="_blank" rel="noreferrer">8e6a0d0c-34aa-fe09-698a-6c815d9b3ef2@gatewaygeomatics.com</a>><br>
Content-Type: text/plain; charset=UTF-8; format=flowed<br>
<br>
Hi Jeremy,<br>
<br>
I would run ogrinfo on that table to see what field to use for your <br>
CLASSITEM, such as:<br>
<br>
ogrinfo PG:"user=postgres password=postgres dbname=mdm6data <br>
host=mxsig-db port=5432" tutoiral.states_ugl_imported -summary<br>
<br>
(your timing is good as the tutorial was recently updated for MapServer 8 )<br>
<br>
-jeff<br>
<br>
<br>
<br>
--<br>
Jeff McKenna<br>
GatewayGeo: Developers of MS4W, MapServer Consulting and Training<br>
co-founder of FOSS4G<br>
<a href="http://gatewaygeo.com/" rel="noreferrer noreferrer" target="_blank">http://gatewaygeo.com/</a><br>
<br>
<br>
<br>
<br>
On 2023-04-29 4:12 p.m., Jeremy JK wrote:<br>
> 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 <br>
> column? Do I have to insert the dbf file into schema? If so, how?<br>
> Thanks<br>
> <br>
> *Error*:<br>
> msDrawMap(): Image handling error. Failed to draw layer named <br>
> 'states_poly'. msPostGISLayerWhichShapes(): Query error. Error executing <br>
> query. Check server logs<br>
> <br>
> <br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
MapServer-users mailing list<br>
<a href="mailto:MapServer-users@lists.osgeo.org" target="_blank" rel="noreferrer">MapServer-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br>
<br>
------------------------------<br>
<br>
End of MapServer-users Digest, Vol 183, Issue 13<br>
************************************************<br>
</blockquote></div>
_______________________________________________<br>
MapServer-users mailing list<br>
<a href="mailto:MapServer-users@lists.osgeo.org" target="_blank" rel="noreferrer">MapServer-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
</blockquote></div>