[MapServer-users] MapServer-users Digest, Vol 183, Issue 13

Jeremy JK jason2017jay at gmail.com
Sun Apr 30 14:03:56 PDT 2023


Hi Jeff,
My understanding, as the tutorial says, is that the class column comes from
the dbf file
That's the tutorial's dataset - shp file and dbf file
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

How to import  states_ugl.dbf together with states_ugl.shp?

I guess this is more of a problem with handling a specific data set for a
specific purpose (tutorial data for the tutorial)

I will practice using files
But would be good to know how to insert the 2 different types of files
"simultaneously" for future reference







On Sun, Apr 30, 2023 at 3:00 PM <mapserver-users-request at lists.osgeo.org>
wrote:

> Send MapServer-users mailing list submissions to
>         mapserver-users at lists.osgeo.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.osgeo.org/mailman/listinfo/mapserver-users
> or, via email, send a message with subject or body 'help' to
>         mapserver-users-request at lists.osgeo.org
>
> You can reach the person managing the list at
>         mapserver-users-owner at lists.osgeo.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of MapServer-users digest..."
>
>
> Today's Topics:
>
>    1. Database problem when using CLASSITEM (Jeremy JK)
>    2. Re: Database problem when using CLASSITEM (Jeff McKenna)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 29 Apr 2023 15:12:26 -0400
> From: Jeremy JK <jason2017jay at gmail.com>
> To: Jason Snyder <mapserver-users at lists.osgeo.org>
> Subject: [MapServer-users] Database problem when using CLASSITEM
> Message-ID:
>         <CAKjBGf+iN=mw+F9=
> fODiXGr6rYnaSKbPV9wxrNAF_-M2-pB+ew at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hola
>
> OK so I am going through the MapServer tutorial
> Example 1-3 to be exact
> the one with the classes
> using classes to split layer polygon into land and water
>
> when shp and dbf file is in filesystem it works fine
> But
> When I import shp file into postgres I get the following error
>
> 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?
> Thanks
>
> *Error*:
> msDrawMap(): Image handling error. Failed to draw layer named
> 'states_poly'. msPostGISLayerWhichShapes(): Query error. Error executing
> query. Check server logs
>
>
>
> *Query: *
>
> http://localhost:8081/cgi-bin/mapserv?map=/opt/map/mdm60/example1-3.map&layer=states_poly&layer=states_line&mode=map
>
>
> *Mapfile*:
> MAP
>   IMAGETYPE      PNG
>   EXTENT         -97.238976 41.619778 -82.122902 49.385620
>   SIZE           400 300
>   SHAPEPATH      "/opt/map/mdm60/ms4w/apps/tutorial/data/"
>   IMAGECOLOR     255 255 255
>
>   LAYER
>     NAME         "states_poly"
>     CONNECTIONTYPE POSTGIS
>     CONNECTION "user=postgres password=postgres dbname=mdm6data
> host=mxsig-db port=5432"
>     DATA         "wkb_geometry from tutoiral.states_ugl_imported using
> srid=3857"
>     STATUS       OFF
>     TYPE         POLYGON
>
> CLASSITEM "CLASS"
>
> CLASS
>       NAME 'States'
>       EXPRESSION 'land'
>   STYLE
>         COLOR      232 232 232
>       END
>     END
>     CLASS
>       NAME 'Water'
>       EXPRESSION 'water'
>       STYLE
>         COLOR      198 198 255
>       END
>     END
>   END
>
>  LAYER
>     NAME         "states_line"
>     CONNECTIONTYPE POSTGIS
>     CONNECTION "user=postgres password=postgres dbname=mdm6data
> host=mxsig-db port=5432"
>     DATA         "wkb_geometry from tutorial.sttes_ugl_imported using
> srid=3875"
>     STATUS       OFF
>     TYPE         LINE
>
>     CLASSITEM    "CLASS"
>
>     CLASS
>       NAME       'State Boundary'
>       EXPRESSION 'land'
>       STYLE
>         COLOR    32 32 32
>       END
>     END
>   END
>
>
> END
>
>
> *Error Log:*[Sat Apr 29 19:08:42 2023].232185 CGI Request 1 on process 1677
> [Sat Apr 29 19:08:42 2023].233452 msDrawMap(): rendering using outputformat
> named png (AGG/PNG).
> [Sat Apr 29 19:08:42 2023].233473 msDrawMap(): WMS/WFS set-up and query,
> 0.000s
> [Sat Apr 29 19:08:42 2023].282742 msPostGISLayerWhichShapes(): Error
> (ERROR:  no existe la columna ?CLASS?
> LINE 1: select "CLASS"::text,ST_AsBinary(("wkb_geometry"),'NDR') as ...
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230429/f3df399b/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 2
> Date: Sun, 30 Apr 2023 14:56:45 -0300
> From: Jeff McKenna <jmckenna at gatewaygeomatics.com>
> To: mapserver-users at lists.osgeo.org
> Subject: Re: [MapServer-users] Database problem when using CLASSITEM
> Message-ID:
>         <8e6a0d0c-34aa-fe09-698a-6c815d9b3ef2 at gatewaygeomatics.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Hi Jeremy,
>
> I would run ogrinfo on that table to see what field to use for your
> CLASSITEM, such as:
>
> ogrinfo PG:"user=postgres password=postgres dbname=mdm6data
> host=mxsig-db port=5432" tutoiral.states_ugl_imported -summary
>
> (your timing is good as the tutorial was recently updated for MapServer 8 )
>
> -jeff
>
>
>
> --
> Jeff McKenna
> GatewayGeo: Developers of MS4W, MapServer Consulting and Training
> co-founder of FOSS4G
> http://gatewaygeo.com/
>
>
>
>
> On 2023-04-29 4:12 p.m., Jeremy JK wrote:
> > Hola
> >
> > OK so I am going through the MapServer tutorial
> > Example 1-3 to be exact
> > the one with the classes
> > using classes to split layer polygon into land and water
> >
> > when shp and dbf file is in filesystem it works fine
> > But
> > When I import shp file into postgres I get the following error
> >
> > 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?
> > Thanks
> >
> > *Error*:
> > msDrawMap(): Image handling error. Failed to draw layer named
> > 'states_poly'. msPostGISLayerWhichShapes(): Query error. Error executing
> > query. Check server logs
> >
> >
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
> ------------------------------
>
> End of MapServer-users Digest, Vol 183, Issue 13
> ************************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230430/c4320aa7/attachment.htm>


More information about the MapServer-users mailing list