[Mapserver-users] Re: querybyattributes with Postgres/Postgis Layer

cgowens at softhome.net cgowens at softhome.net
Mon Dec 1 09:25:30 EST 2003


Try using the TEMPLATE option under CLASS for the LAYER.  Set the the url to 
your query.php file that runs the SQL statement. 

Colin 


mapserver-users-request at lists.gis.umn.edu writes: 

> Send Mapserver-users mailing list submissions to
> 	mapserver-users at lists.gis.umn.edu 
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> or, via email, send a message with subject or body 'help' to
> 	mapserver-users-request at lists.gis.umn.edu 
> 
> You can reach the person managing the list at
> 	mapserver-users-admin at lists.gis.umn.edu 
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Mapserver-users digest..." 
> 
> 
> Today's Topics: 
> 
>    1. Problems with tab files in MapLab (Stephen Wallace)
>    2. Re: [ms4w-users] Problems with tab files in MapLab (Daniel Morissette)
>    3. MapServer passes 82/83 tests of the OGC WMS testsuite (Daniel Morissette)
>    4. Re: MapServer passes 82/83 tests of the OGC WMS testsuite (Daniel Morissette)
>    5. Re: Re: MapServer passes 82/83 tests of the OGC
>        WMS testsuite (Doug Cates)
>    6. RE: MapServer passes 82/83 tests of the OGC WMS
>        testsuite (Kralidis,Tom [Burlington])
>    7. Re: Re: MapServer passes 82/83 tests of the OGC
>        WMS testsuite (Gerry Creager N5JXS)
>    8. Re: MapServer passes 82/83 tests of the OGC WMS testsuite (Bart van den Eijnden)
>    9. Re: querybyattributes with Postgres/Postgis Layer (Damian Schroder)
>   10. Segmentation Fault -- reference image -- PHP (Ed Martin) 
> 
> --__--__--

> 
> Message: 9
> Date: Sat, 29 Nov 2003 08:41:48 -0800 (PST)
> From: Damian Schroder <map_surfer at yahoo.com>
> Subject: Re: [Mapserver-users] querybyattributes with Postgres/Postgis Layer
> To: mapserver-users at lists.gis.umn.edu 
> 
> --0-1435250590-1070124108=:89418
> Content-Type: text/plain; charset=us-ascii 
> 
> try using a filter instead of querybyattributes. 
> 
> Nicol Hermann <mapserver at geochem.de> wrote:Dear List, 
> 
> i trying to do a querybyattributes Query with a Postgres/Postgis layer
> and get the following error: 
> 
> Warning: [MapServer Error]: prep_DB(): Error executing POSTGIS DECLARE
> (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
> plzort01::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from plz_gebiete WHERE (Mutterstadt) and (the_geom && setSRID( 'BOX3D(5.865627 46.57242768,15.039879 55.75900832)'::BOX3D,find_srid('','plz_gebiete','the_geom') ))' 
> 
> here is the relevant part of my code: 
> 
> $layer = $Map ->getLayerbyname("Regionen");
> $layer -> set("status", MS_ON );
> $status = $layer->querybyattributes("plzort01", "Mutterstadt",
> MS_MULTIPLE); 
> 
> It seems that the 'qitem' (plzort01) won't be evaluated because it is
> not present in the SQL statement.
> I also tried the qitem with upper case. The same error appears. 
> 
> The debugging message on my shell says: 
> ERROR: Attribute "mutterstadt" not found 
> 
> My Postgis Version is: Mappostgis.c - version of June 12/2003. 
> and i`am using Mapserver 4.0.1 on a Linux box. 
> 
> Does anybody know how I can solve this problem?
> Many thanks
> Nicol 
> 
> 
> -- 
> Nicol Hermann  
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> --0-1435250590-1070124108=:89418
> Content-Type: text/html; charset=us-ascii 
> 
> <DIV>try using&nbsp;a filter instead of querybyattributes.<BR><BR><B><I>Nicol Hermann &lt;mapserver at geochem.de&gt;</I></B> wrote:
> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Dear List,<BR><BR>i trying to do a querybyattributes Query with a Postgres/Postgis layer<BR>and get the following error:<BR><BR>Warning: [MapServer Error]: prep_DB(): Error executing POSTGIS DECLARE<BR>(the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT<BR>plzort01::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from plz_gebiete WHERE (Mutterstadt) and (the_geom &amp;&amp; setSRID( 'BOX3D(5.865627 46.57242768,15.039879 55.75900832)'::BOX3D,find_srid('','plz_gebiete','the_geom') ))'<BR><BR>here is the relevant part of my code:<BR><BR>$layer = $Map -&gt;getLayerbyname("Regionen");<BR>$layer -&gt; set("status", MS_ON );<BR>$status = $layer-&gt;querybyattributes("plzort01", "Mutterstadt",<BR>MS_MULTIPLE);<BR><BR>It seems that the 'qitem' (plzort01) won't be evaluated because it is<BR>not present in the SQL statement.<BR>I also tried the q!
>  item with
>  upper case. The same error appears.<BR><BR>The debugging message on my shell says: <BR>ERROR: Attribute "mutterstadt" not found<BR><BR>My Postgis Version is: Mappostgis.c - version of June 12/2003. <BR>and i`am using Mapserver 4.0.1 on a Linux box.<BR><BR>Does anybody know how I can solve this problem?<BR>Many thanks<BR>Nicol<BR><BR><BR>-- <BR>Nicol Hermann <MAPSERVER at GEOCHEM.DE><BR><BR>_______________________________________________<BR>Mapserver-users mailing list<BR>Mapserver-users at lists.gis.umn.edu<BR>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users</BLOCKQUOTE></DIV><p><hr SIZE=1>
> Do you Yahoo!?<br>
> <a href="http://us.rd.yahoo.com/slv/mailtag/*http://companion.yahoo.com/">Free Pop-Up Blocker - Get it now</a>
> --0-1435250590-1070124108=:89418-- 
> 
> --__--__-- 
> 
> Message: 10
> Date: Sat, 29 Nov 2003 11:59:53 -0500
> From: Ed Martin <edman007x at mac.com>
> To: mapserver-users at lists.gis.umn.edu
> Subject: [Mapserver-users] Segmentation Fault -- reference image -- PHP 
> 
> i am using the map file and map stuff from the cvs mapserver (did not 
> compile from cvs, i used the stable version 4.0.1) and when i try to 
> get the reference image using a very simple script i get the jpeg 
> header an then a segmentation fault when run in the command line and a 
> blank page when in a browser, turning off the jpeg header still gives 
> me a blank page 
> 
> here is the php file i am using 
> 
> <?
> require_once('../inc/conf.inc.php');//get config
> //load mapscript
> dl("php_mapscript.so");
> header("Content-type: image/jpeg");
> // start map
> $map=ms_newMapObj("tests/test.map");
> $img=$map->drawReferenceMap();
> $img->saveImage('');
> ?> 
> 
> and here is the reference part of the map file 
> 
> #refence map
>    REFERENCE
>      IMAGE ./reference.jpeg
>      EXTENT -0.5 50.977222 0.5 51.977222
>      SIZE 120 120
>      STATUS ON
>      COLOR 255 255 0
>      OUTLINECOLOR 255 100 0
>      STATUS ON
>      MARKER "line"
>      MARKERSIZE 5
>      MINBOXSIZE 50
>      MINBOXSIZE 100
>    END 
> 
> i have output set to jpeg and changing the reference image to jpg or 
> png doesn't help and i tried gif and that gave an error saying that it 
> couldn't load it (probably because gifs aren't supported by gd, but 
> this page ( 
> http://mapserver.gis.umn.edu/doc40/mapfile-reference.html#referencemap 
> ) says it has to be a gif) 
> 
> could it be the way i made the reference image, i just took the main 
> image, cropped out the boarder, shrunk it to 120x120 and saved it in 
> various formats 
> 
> i see nothing in my apache logs, but i know it is logging to them 
> because a parse error will show up, i have error reporting set to the 
> highest (E_ALL), i'm using mapserver 4.0.1, php 4.3.4 as CGI, apache 
> 2.0.48, slackware linux 9.0 
> 
> so does anyone have any clue as to what is causing this, my map file, 
> do i have to put more stuff in the php file, is it the way i made the 
> image, or is it a bug 
> 
>  
> 
> --__--__-- 
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users 
> 
> 
> End of Mapserver-users Digest
 



More information about the mapserver-users mailing list