itemquery

Lluís Garcia i Mestres lluisgm at GMAIL.COM
Mon May 9 12:43:55 PDT 2005


Hi list,

I'm trying to implement the itemquery option shown in mapserver test
suite. As I could read in old messages, the filter option isn't needed
anymore and now requires the qlayer, qitem and qstring.

I can display the item query also with a query map, but my problem is
to adjust the qstring in order to select the item from a text list. I
can just display the item query  if I write the exact item that I want
in the qstring.

This is the html from where I want to launch the itemquery. As you see
I must specify in the qstring the item, how can I get the item from
the text options?

<SCRIPT language=javascript>
    var parcela = new Array('00001','00002','00011','09001','09006');
    
    function write_parcela() {
      var i;

      for(i=0; i<parcela.length; i++)
        document.write("<option> " + parcela[i] + "\n");
    }
</SCRIPT>

<BODY bgcolor=#e2deae>

<body bgcolor="#e2deae">

<font size="+2" face="arial,helvetica"><b>Item
query</b></font><b><font size="3"
face="arial">      >>>  Arees de les
parcel·les </font></b>

<p>

<BR>

<FORM name=test action=/cgi-bin/mapserv>
<INPUT type=hidden
value=/var/www/html/mapserver/dades/santguim/map-script/santguim-java-itemquery.map
name=map>
<INPUT type=hidden value="363469 4.60971e+06 371839 4.61674e+06" name=imgext> 
<INPUT type=hidden value=itemquery name=mode> 
<INPUT type=hidden value=/cgi-bin/mapserv name=program>


<input type="hidden" name="qlayer" value="parcela">
<input type="hidden" name="qitem" value="PARCELA">
<input type="hidden" name="qstring" value="09001">

<font size="3" face="arial">Selecciona una parcel·la:</font> 
<SELECT size=1 name=name> 
  <SCRIPT language=javascript>write_parcela()</SCRIPT>
</SELECT> <INPUT type=submit value=Go!>

 
 </FORM></P></BODY></HTML>


My map file is

# Característiques map

NAME colza
STATUS ON
SIZE 500 400
SYMBOLSET /var/www/html/mapserver/dades/santguim/map-script/marker.sym
EXTENT 363469 4.60971e+06 371839 4.61674e+06
UNITS meters
IMAGECOLOR 219 238 238
IMAGETYPE png

# Inici web

WEB
 IMAGEPATH /var/www/html/mapserver/tmp/
 IMAGEURL "/mapserver/tmp/"
END

# Mapa per a consultes

QUERYMAP
  COLOR 255 255 0
  SIZE 500 400
  STATUS ON
  STYLE HILITE
END

# Capes vectorials

LAYER
  NAME parcela
  TYPE POLYGON
  STATUS DEFAULT
  DATA /var/www/html/mapserver/dades/santguim/shp/parcela.shp
  CLASS
     COLOR 212 212 212
     OUTLINECOLOR 0 0 0
     TEMPLATE /var/www/html/mapserver/dades/santguim/templates/parcela-itemquery.html
  END
END

END 



The attribute template is

<td><img border="2"
src="http://localhost/cgi-bin/mapserv?map=/var/www/html/mapserver/dades/santguim/map-script/santguim-java-itemquery.map&mode=itemquerymap&name=[name_esc]&mapext=shapes&qlayer=parcela&qitem=PARCELA&qstring=[qstring]"
height="400" width="500"></td>
<TD><img border="2" src="[img]" alt="query map" align="middle"></TD>
</tr>


Thanks

Lluís



More information about the MapServer-users mailing list