[Mapserver-users] why --> msQueryByAttributes():Queryerror. No query expressiondefined

Javier Castillejo Montes jcastil1 at tragsa.es
Wed Jul 7 08:08:12 PDT 2004


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C46434.3B3CAA48
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks... it works!!!!

thanks a lot.


-----Mensaje original-----
De: David Fawcett [mailto:David.Fawcett at state.mn.us]
Enviado el: mi=E9rcoles, 07 de julio de 2004 15:50
Para: Javier Castillejo Montes
CC: mapserver-users at lists.gis.umn.edu
Asunto: RE: [Mapserver-users] why --> msQueryByAttributes():Queryerror.
No query expressiondefined


Javier,=20

The syntax for itemqueries changed after version 3.5 or so. =20

Queries no longer use a filter in the Map file.  Instead, you need to
pass the variables 'qlayer', 'qitem', and 'qstring' in the URL.  They
are documented here:=20
http://mapserver.gis.umn.edu/doc42/cgi-reference.html#qitem=20

It should look something like:

...&qlayer=3Dlayer1&qitem=3DFIELD2&qstring=3D('[FIELD2]'=3D'10')

&qlayer=3Dprovin&qitem=3DNOMBRE&qstring=3D'Juarez'

(This assumes that there is a 'provin' with the name 'Juarez'.  If you
build this URL string dynamically in the form at the bottom of this
message, it should look something like this: =20

<td><img border=3D"2"
src=3D"[mapserv]?map=3D[map]&name=3D&mode=3Ditemquerymap&mapext=3Dshapes=
&qlayer=3Dprovin
&qitem=3DNOMBRE&qstring=3D'[name_esc]'
" height=3D"300" width=3D"300"></td>

David.



David J. Fawcett
MN Office of Environmental Assistance

>>> Javier Castillejo Montes <jcastil1 at tragsa.es> 7/7/2004 2:08:37 AM
>>>
Hi,
mapserv_41.exe is the exe im using... the wrong thing could be my code,
that
is obsolete.

I took the code from a web page and translate it into my needs....=20

Javier

-----Mensaje original-----
De: David Fawcett [mailto:David.Fawcett at state.mn.us]=20
Enviado el: martes, 06 de julio de 2004 16:58
Para: mapserver-users at lists.gis.umn.edu; Javier Castillejo Montes
Asunto: Re: [Mapserver-users] why --> msQueryByAttributes():
Queryerror.
No query expressiondefined


I may be mistaken, but the example looks a little old.  What version
of
MapServer are you using? =20

David.

David J. Fawcett
MN Office of Environmental Assistance

>>> Javier Castillejo Montes <jcastil1 at tragsa.es> 7/6/2004 8:00:55 AM
>>>
Hi all,
=20

Does anyone know why this code has an error. I'm just trying to use a
mapserver example  from the internet, I copied the code made the
changes
necesaries and... ERROR!!!! :-(
=20

### ERROR: =20
  msQueryByAttributes(): Query error. No query expression defined.
=20
### main html
=20

<html>
<body>
<form name=3D"mapserv" method=3D"get"
action=3D"//[host]/scripts/mapserv.exe">
<input type=3D"text" name=3D"mapserv" =
value=3D"//[host]/scripts/mapserv.exe"
size=3D100%>
<input type=3D"text" name=3D"map" value=3D"[path]/map/case1.map" =
size=3D100%>
<input type=3D"text" name=3D"map_web_imagepath" value=3D"[path]/tmp/"=20
size=3D100%>
<input type=3D"text" name=3D"map_web_imageurl" value=3D"[path]/tmp/">
<input type=3D"text" name=3D"mode" value=3D"itemquery"  size=3D100%>
<input type=3D"text" name=3D"qlayer" value=3D"provin"  size=3D100%>
=20
<br><br><br><br><br><br>
Select
=20
<input type=3D"text" name=3D"name" id=3D"name" value=3D"mad">
=20
<br>
=20
<input type=3D"submit" value=3D"Go!">
=20
</form>
</body>
</html>
=20

## map file
=20
MAP
  NAME case1
  SHAPEPATH      "../data"
  SIZE 300 300
  EXTENT -50000 4000000 1100000 4800000
=20
  WEB
    IMAGEPATH '../data/tmp/'
    IMAGEURL  '../data/tmp/'
  END
=20
  QUERYMAP
    STATUS ON
    STYLE HILITE
    COLOR 255 255 0
  END
=20
  LAYER
    NAME provin
    DATA provin
    STATUS DEFAULT
    TYPE POLYGON
    FILTERITEM nombre
    FILTER "%name%"
    CLASS
      COLOR 212 212 212
      OUTLINECOLOR 0 0 0
      TEMPLATE "../html/case1_template.html"
    END
  END
=20
END
=20

### template file
=20
<html>
<head>
  <title>MapServer Test Suite - ItemQuery</title>
</head>
=20
<body bgcolor=3D"#ffffff">
=20
<font size=3D"+2" face=3D"arial,helvetica"><b>Case 1: Simple ItemQuery
With
QueryMap</b></font>
=20
<p>
=20
This is just a simple dump of a few attributes for an individual
polygon
in the test suites counties layer:
=20
<p>
=20
<b>Name:</b> [Name]<br>
<b>ID Provincia:</b> [prov]<br>
<b>Comunidad Code:</b> [Comunidadc]<br>
=20
<p>
=20
and here's the map of the query results (you can zoom to a set of
results as
well):
=20
<p>
=20
<table cellpadding=3D"5">
<tr>
<td><img border=3D"2" src=3D"[img]" height=3D"300" width=3D"300"></td>
<td><img border=3D"2"
src=3D"[mapserv]?map=3D[map]&name=3D[name_esc]&mode=3Ditemquerymap&mapex=
t=3Dshapes&qla
yer=3D[qlayer]" height=3D"300" width=3D"300"></td>
</tr>
</table>
=20
</body>
</html>
=20
=20
thanks in advance
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users

------_=_NextPart_001_01C46434.3B3CAA48
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>RE: [Mapserver-users] why  -->  =
msQueryByAttributes():Queryerror. No query expressiondefined</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Thanks... it works!!!!</FONT>
</P>

<P><FONT SIZE=3D2>thanks a lot.</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>-----Mensaje original-----</FONT>
<BR><FONT SIZE=3D2>De: David Fawcett [<A =
HREF=3D"mailto:David.Fawcett at state.mn.us">mailto:David.Fawcett at state.mn.=
us</A>]</FONT>
<BR><FONT SIZE=3D2>Enviado el: mi=E9rcoles, 07 de julio de 2004 =
15:50</FONT>
<BR><FONT SIZE=3D2>Para: Javier Castillejo Montes</FONT>
<BR><FONT SIZE=3D2>CC: mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2>Asunto: RE: [Mapserver-users] why --> =
msQueryByAttributes():Queryerror.</FONT>
<BR><FONT SIZE=3D2>No query expressiondefined</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Javier, </FONT>
</P>

<P><FONT SIZE=3D2>The syntax for itemqueries changed after version 3.5 =
or so.  </FONT>
</P>

<P><FONT SIZE=3D2>Queries no longer use a filter in the Map file.  =
Instead, you need to</FONT>
<BR><FONT SIZE=3D2>pass the variables 'qlayer', 'qitem', and 'qstring' =
in the URL.  They</FONT>
<BR><FONT SIZE=3D2>are documented here: </FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://mapserver.gis.umn.edu/doc42/cgi-reference.html#qitem" =
TARGET=3D"_blank">http://mapserver.gis.umn.edu/doc42/cgi-reference.html#=
qitem</A> </FONT>
</P>

<P><FONT SIZE=3D2>It should look something like:</FONT>
</P>

<P><FONT =
SIZE=3D2>...&qlayer=3Dlayer1&qitem=3DFIELD2&qstring=3D('[FIE=
LD2]'=3D'10')</FONT>
</P>

<P><FONT =
SIZE=3D2>&qlayer=3Dprovin&qitem=3DNOMBRE&qstring=3D'Juarez'<=
/FONT>
</P>

<P><FONT SIZE=3D2>(This assumes that there is a 'provin' with the name =
'Juarez'.  If you</FONT>
<BR><FONT SIZE=3D2>build this URL string dynamically in the form at the =
bottom of this</FONT>
<BR><FONT SIZE=3D2>message, it should look something like this:  =
</FONT>
</P>

<P><FONT SIZE=3D2><td><img border=3D"2"</FONT>
<BR><FONT =
SIZE=3D2>src=3D"[mapserv]?map=3D[map]&name=3D&mode=3Ditemqu=
erymap&mapext=3Dshapes&qlayer=3Dprovin&qitem=3DNOMBRE&qs=
tring=3D'[name_esc]'</FONT>
<BR><FONT SIZE=3D2>" height=3D"300" =
width=3D"300"></td></FONT>
</P>

<P><FONT SIZE=3D2>David.</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2>David J. Fawcett</FONT>
<BR><FONT SIZE=3D2>MN Office of Environmental Assistance</FONT>
</P>

<P><FONT SIZE=3D2>>>> Javier Castillejo Montes =
<jcastil1 at tragsa.es> 7/7/2004 2:08:37 AM</FONT>
<BR><FONT SIZE=3D2>>>></FONT>
<BR><FONT SIZE=3D2>Hi,</FONT>
<BR><FONT SIZE=3D2>mapserv_41.exe is the exe im using... the wrong =
thing could be my code,</FONT>
<BR><FONT SIZE=3D2>that</FONT>
<BR><FONT SIZE=3D2>is obsolete.</FONT>
</P>

<P><FONT SIZE=3D2>I took the code from a web page and translate it into =
my needs.... </FONT>
</P>

<P><FONT SIZE=3D2>Javier</FONT>
</P>

<P><FONT SIZE=3D2>-----Mensaje original-----</FONT>
<BR><FONT SIZE=3D2>De: David Fawcett [<A =
HREF=3D"mailto:David.Fawcett at state.mn.us">mailto:David.Fawcett at state.mn.=
us</A>] </FONT>
<BR><FONT SIZE=3D2>Enviado el: martes, 06 de julio de 2004 16:58</FONT>
<BR><FONT SIZE=3D2>Para: mapserver-users at lists.gis.umn.edu; Javier =
Castillejo Montes</FONT>
<BR><FONT SIZE=3D2>Asunto: Re: [Mapserver-users] why --> =
msQueryByAttributes():</FONT>
<BR><FONT SIZE=3D2>Queryerror.</FONT>
<BR><FONT SIZE=3D2>No query expressiondefined</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>I may be mistaken, but the example looks a little =
old.  What version</FONT>
<BR><FONT SIZE=3D2>of</FONT>
<BR><FONT SIZE=3D2>MapServer are you using?  </FONT>
</P>

<P><FONT SIZE=3D2>David.</FONT>
</P>

<P><FONT SIZE=3D2>David J. Fawcett</FONT>
<BR><FONT SIZE=3D2>MN Office of Environmental Assistance</FONT>
</P>

<P><FONT SIZE=3D2>>>> Javier Castillejo Montes =
<jcastil1 at tragsa.es> 7/6/2004 8:00:55 AM</FONT>
<BR><FONT SIZE=3D2>>>></FONT>
<BR><FONT SIZE=3D2>Hi all,</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>

<P><FONT SIZE=3D2>Does anyone know why this code has an error. I'm just =
trying to use a</FONT>
<BR><FONT SIZE=3D2>mapserver example  from the internet, I copied =
the code made the</FONT>
<BR><FONT SIZE=3D2>changes</FONT>
<BR><FONT SIZE=3D2>necesaries and... ERROR!!!! :-(</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>

<P><FONT SIZE=3D2>### ERROR:  </FONT>
<BR><FONT SIZE=3D2>  msQueryByAttributes(): Query error. No query =
expression defined.</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>### main html</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>

<P><FONT SIZE=3D2><html></FONT>
<BR><FONT SIZE=3D2><body></FONT>
<BR><FONT SIZE=3D2><form name=3D"mapserv" =
method=3D"get"</FONT>
<BR><FONT =
SIZE=3D2>action=3D"//[host]/scripts/mapserv.exe"></FONT>
<BR><FONT SIZE=3D2><input type=3D"text" =
name=3D"mapserv" =
value=3D"//[host]/scripts/mapserv.exe"</FONT>
<BR><FONT SIZE=3D2>size=3D100%></FONT>
<BR><FONT SIZE=3D2><input type=3D"text" =
name=3D"map" value=3D"[path]/map/case1.map" =
size=3D100%></FONT>
<BR><FONT SIZE=3D2><input type=3D"text" =
name=3D"map_web_imagepath" value=3D"[path]/tmp/" =
</FONT>
<BR><FONT SIZE=3D2>size=3D100%></FONT>
<BR><FONT SIZE=3D2><input type=3D"text" =
name=3D"map_web_imageurl" =
value=3D"[path]/tmp/"></FONT>
<BR><FONT SIZE=3D2><input type=3D"text" =
name=3D"mode" value=3D"itemquery"  =
size=3D100%></FONT>
<BR><FONT SIZE=3D2><input type=3D"text" =
name=3D"qlayer" value=3D"provin"  =
size=3D100%></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT =
SIZE=3D2><br><br><br><br><br><br></F=
ONT>
<BR><FONT SIZE=3D2>Select</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><input type=3D"text" =
name=3D"name" id=3D"name" =
value=3D"mad"></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><br></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><input type=3D"submit" =
value=3D"Go!"></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2></form></FONT>
<BR><FONT SIZE=3D2></body></FONT>
<BR><FONT SIZE=3D2></html></FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>

<P><FONT SIZE=3D2>## map file</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>MAP</FONT>
<BR><FONT SIZE=3D2>  NAME case1</FONT>
<BR><FONT SIZE=3D2>  SHAPEPATH      =
"../data"</FONT>
<BR><FONT SIZE=3D2>  SIZE 300 300</FONT>
<BR><FONT SIZE=3D2>  EXTENT -50000 4000000 1100000 4800000</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>  WEB</FONT>
<BR><FONT SIZE=3D2>    IMAGEPATH '../data/tmp/'</FONT>
<BR><FONT SIZE=3D2>    IMAGEURL  =
'../data/tmp/'</FONT>
<BR><FONT SIZE=3D2>  END</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>  QUERYMAP</FONT>
<BR><FONT SIZE=3D2>    STATUS ON</FONT>
<BR><FONT SIZE=3D2>    STYLE HILITE</FONT>
<BR><FONT SIZE=3D2>    COLOR 255 255 0</FONT>
<BR><FONT SIZE=3D2>  END</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>  LAYER</FONT>
<BR><FONT SIZE=3D2>    NAME provin</FONT>
<BR><FONT SIZE=3D2>    DATA provin</FONT>
<BR><FONT SIZE=3D2>    STATUS DEFAULT</FONT>
<BR><FONT SIZE=3D2>    TYPE POLYGON</FONT>
<BR><FONT SIZE=3D2>    FILTERITEM nombre</FONT>
<BR><FONT SIZE=3D2>    FILTER "%name%"</FONT>
<BR><FONT SIZE=3D2>    CLASS</FONT>
<BR><FONT SIZE=3D2>      COLOR 212 212 =
212</FONT>
<BR><FONT SIZE=3D2>      OUTLINECOLOR 0 0 =
0</FONT>
<BR><FONT SIZE=3D2>      TEMPLATE =
"../html/case1_template.html"</FONT>
<BR><FONT SIZE=3D2>    END</FONT>
<BR><FONT SIZE=3D2>  END</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>END</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>

<P><FONT SIZE=3D2>### template file</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><html></FONT>
<BR><FONT SIZE=3D2><head></FONT>
<BR><FONT SIZE=3D2>  <title>MapServer Test Suite - =
ItemQuery</title></FONT>
<BR><FONT SIZE=3D2></head></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><body bgcolor=3D"#ffffff"></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><font size=3D"+2" =
face=3D"arial,helvetica"><b>Case 1: Simple =
ItemQuery</FONT>
<BR><FONT SIZE=3D2>With</FONT>
<BR><FONT SIZE=3D2>QueryMap</b></font></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><p></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>This is just a simple dump of a few attributes for =
an individual</FONT>
<BR><FONT SIZE=3D2>polygon</FONT>
<BR><FONT SIZE=3D2>in the test suites counties layer:</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><p></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><b>Name:</b> [Name]<br></FONT>
<BR><FONT SIZE=3D2><b>ID Provincia:</b> =
[prov]<br></FONT>
<BR><FONT SIZE=3D2><b>Comunidad Code:</b> =
[Comunidadc]<br></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><p></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>and here's the map of the query results (you can =
zoom to a set of</FONT>
<BR><FONT SIZE=3D2>results as</FONT>
<BR><FONT SIZE=3D2>well):</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><p></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><table cellpadding=3D"5"></FONT>
<BR><FONT SIZE=3D2><tr></FONT>
<BR><FONT SIZE=3D2><td><img border=3D"2" =
src=3D"[img]" height=3D"300" =
width=3D"300"></td></FONT>
<BR><FONT SIZE=3D2><td><img border=3D"2"</FONT>
<BR><FONT =
SIZE=3D2>src=3D"[mapserv]?map=3D[map]&name=3D[name_esc]&mod=
e=3Ditemquerymap&mapext=3Dshapes&qla</FONT>
<BR><FONT SIZE=3D2>yer=3D[qlayer]" height=3D"300" =
width=3D"300"></td></FONT>
<BR><FONT SIZE=3D2></tr></FONT>
<BR><FONT SIZE=3D2></table></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2></body></FONT>
<BR><FONT SIZE=3D2></html></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>thanks in advance</FONT>
<BR><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>Mapserver-users mailing list</FONT>
<BR><FONT SIZE=3D2>Mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://lists.gis.umn.edu/mailman/listinfo/mapserver-users" =
TARGET=3D"_blank">http://lists.gis.umn.edu/mailman/listinfo/mapserver-us=
ers</A></FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C46434.3B3CAA48--



More information about the MapServer-users mailing list