[Mapserver-users] Querying on multiple fields

Roger Boily boily at bsw.org
Wed Feb 4 03:33:06 EST 2004


This is a multi-part message in MIME format.
--------------030003020204010206030007
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi to all,
after hundred of tests, I've found the hic..
When using the qstring argument in the format <'[FIELD]'=value>, on 
MapServer running on Windows,
you do not need to add the qitem argument (as read somewhere...), but 
you need it on a Linux machine....
So the failing link will become:
http://213.45.107.14/cgi-bin/mapserv?&map=/var/www/html/sittel/procida/urbis.map&layer=fogli&mapext=shapes&mode=itemnquery&qlayer=fogli&qitem=FOGLIO_N&qstring=('[FOGLIO_N]'%20IN%20'10')

Thanks to all
Roger


Roger Boily wrote:

> Hi Stephen,
> Thanks for answering. Yes, I've escaped the spaces with %20 and tried 
> to escape ' with %27 too.
> No way to make it run. I had it working for one year with MapServer 
> 3.6 (both Linux and Win) and it works
> fine also with the qstring modifications on MapServer 4.0 for Windows, 
> but I can't figure out where is
> the problem with Linux (tested on two servers). Even the simple 
> &qstring=('[PART_N]' IN '556') does not
> work. It works fine with &qitem=PART_N&qstring=556 .
> To help you in helping me :-), I have made an example on my local 
> testing server:
> The first url works properly and the second one fails.
> http://213.45.107.14/cgi-bin/mapserv?&map=/var/www/html/sittel/procida/urbis.map&layer=fogli&mapext=shapes&mode=itemnquery&qlayer=fogli&qitem=FOGLIO_N&qstring=10
> http://213.45.107.14/cgi-bin/mapserv?&map=/var/www/html/sittel/procida/urbis.map&layer=fogli&mapext=shapes&mode=itemnquery&qlayer=fogli&qstring=([FOGLIO_N]'%20IN%20'10')
> I attach also the map file.
> I need the second one to work because I have to query two fields at once.
> ex: FOGLIO_N = 10 AND PART_N = 254
>
> Thanks in advance, Roger
>
> ----------------------------
> MAP FILE: urbis.map
> ----------------------------
> NAME urbis
> STATUS ON
> SIZE 650 400
> EXTENT 475.66 2404.5 5974.34 6239.61
> UNITS meters
> SHAPEPATH "data"
> IMAGETYPE PNG
> IMAGECOLOR 153 153 153
> TRANSPARENT ON
> FONTSET "/var/www/html/sittel/procida/font/fonts.txt"
>
> WEB
>   TEMPLATE header_1024.html
>   IMAGEPATH '/var/www/html/tmp/'
>   IMAGEURL '/tmp/'
>   MINSCALE 100
> END  #WEB
>
> QUERYMAP
>   STATUS ON
>   STYLE HILITE
>   COLOR 255 255 0  # highlight color is yellow
> END
>
> ###### LAYER C A T A S T O ###########
> LAYER
>   NAME 'catasto'
>   TYPE Polygon
>   STATUS ON
>   DATA 'lotti'
> #  TEMPLATE index_basso.phtml
>   LABELITEM 'PART_N'
>   MAXSCALE 25000
>   CLASS
>     Name 'catasto'
>     LABEL
>       TYPE TRUETYPE
>       FONT time
>       BUFFER 3
>       COLOR 255 0 0
>       POSITION CC
>       SIZE 8
>     END
>     OUTLINECOLOR 100 255 000
>   END  # CLASS
> END  # LAYER
>
> ######  LAYER   F O G L I  ########
> LAYER
>   NAME "fogli"
>   TYPE Polygon
>   STATUS ON
>   DATA "fogli"
>   LABELITEM 'FOGLIO_N'
>   TEMPLATE header_1024.html
>   CLASS
>     Name 'foglio'
>     TEXT (Foglio [FOGLIO_N])
>     LABEL
>       TYPE TRUETYPE
>       FONT time
>       BUFFER 1
>       COLOR 0 0 0
>       POSITION auto
>       SIZE 10
>     END
>     OUTLINECOLOR 255 255 255
>   END  # CLASS
> END  # LAYER fogli
>
> END
> ----------------------------------
> End of map file
> ----------------------------------
>
> Steve Lime wrote:
>
>>Are you escaping the value ('[PART_N]' IN '556,557' AND '[ID_N]' IN
>>'24') properly? Spaces aren't allowed and should be replaced with either
>>a + or a %20. We should still track down the source of the error though,
>>error 500's are never good.
>>
>>Steve
>>
>>
>>Stephen Lime
>>Data & Applications Manager
>>
>>Minnesota DNR
>>500 Lafayette Road
>>St. Paul, MN 55155
>>651-297-2937
>>
>>  
>>
>>>>>Roger Boily <boily at bsw.org> 2/3/2004 6:33:11 AM >>>
>>>>>        
>>>>>
>>Hi,
>>
>>On a cgi url I've tried to query on multiple fields with this:
>>NB: for easy reading space and " are normals but I used %20(space) and
>>
>>%27(')
>>&qstring=('[PART_N]' IN '556,557' AND '[ID_N]' IN '24')
>>it works perfectly on windows Mapserver 4.0.1
>>
>>But I receive error 500 from Apache on linux: (Premature end of script
>>
>>headers: mapserv)
>>&qitem=PART_N&qstring=556 works fine on linux
>>but I receive the same error with:
>>&qstring=('[PART_N]' IN '556')
>>
>>Is there anyone who has any idea?
>>
>>Is there a way to make multiple fileds query with qitem and qstring?
>>
>>Thanks a lot
>>
>>Roger
>>
>>
>>_______________________________________________
>>Mapserver-users mailing list
>>Mapserver-users at lists.gis.umn.edu 
>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>  
>>

--------------030003020204010206030007
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Hi to all,<br>
after hundred of tests, I've found the hic..<br>
When using the qstring argument in the format &lt;'[FIELD]'=value&gt;,
on MapServer running on Windows, <br>
you do not need to add the qitem argument (as read somewhere...), but
you need it on a Linux machine....<br>
So the failing link will become:<br>
<tt><a class="moz-txt-link-freetext"
 href="http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qstring=%28">http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qitem=FOGL</a></tt><tt><a
 class="moz-txt-link-freetext"
 href="http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qstring=%28">IO_N&amp;qstring=</a></tt><a
 class="moz-txt-link-freetext"
 href="http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qstring=%28"><tt>('[FOGLIO_N]'%20IN%20'10')</tt></a><br>
<br>
Thanks to all<br>
Roger<br>
<br>
<br>
Roger Boily wrote:<br>
<blockquote type="cite" cite="mid4020A63E.9070805 at bsw.org">
  <meta http-equiv="Content-Type" content="text/html;">
  <title></title>
  <tt>Hi Stephen,<br>
Thanks for answering. Yes, I've escaped the spaces with %20 and tried
to escape ' with %27 too.<br>
No way to make it run. I had it working for one year with MapServer 3.6
(both Linux and Win) and it works<br>
fine also with the qstring modifications on MapServer 4.0 for Windows,
but I can't figure out where is<br>
the problem with Linux (tested on two servers). Even the simple </tt><tt>&amp;qstring=('[PART_N]'
IN '556') does not<br>
work. It works fine with &amp;qitem=PART_N&amp;qstring=556 .<br>
To help you in helping me :-), I have made an example on my local
testing server:<br>
The first url works properly and the second one fails.<br>
  <a class="moz-txt-link-freetext"
 href="http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qitem=FOGLIO_N&amp;qstring=10">http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qitem=FOGLIO_N&amp;qstring=10</a><br>
  <a class="moz-txt-link-freetext"
 href="http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qstring=%28">http://213.45.107.14/cgi-bin/mapserv?&amp;map=/var/www/html/sittel/procida/urbis.map&amp;layer=fogli&amp;mapext=shapes&amp;mode=itemnquery&amp;qlayer=fogli&amp;qstring=(</a>[FOGLIO_N]'%20IN%20'10')<br>
I attach also the map file.<br>
I need the second one to work because I have to query two fields at
once.<br>
ex: FOGLIO_N = 10 AND PART_N = 254<br>
  <br>
Thanks in advance, Roger<br>
  <br>
----------------------------<br>
MAP FILE: urbis.map<br>
----------------------------<br>
NAME urbis<br>
STATUS ON<br>
SIZE 650 400<br>
EXTENT 475.66 2404.5 5974.34 6239.61<br>
UNITS meters<br>
SHAPEPATH "data"<br>
IMAGETYPE PNG<br>
IMAGECOLOR 153 153 153<br>
TRANSPARENT ON<br>
FONTSET "/var/www/html/sittel/procida/font/fonts.txt"<br>
  <br>
WEB<br>
&nbsp; TEMPLATE header_1024.html<br>
&nbsp; IMAGEPATH '/var/www/html/tmp/'<br>
&nbsp; IMAGEURL '/tmp/'<br>
&nbsp; MINSCALE 100<br>
END&nbsp; #WEB<br>
  <br>
QUERYMAP<br>
&nbsp; STATUS ON<br>
&nbsp; STYLE HILITE<br>
&nbsp; COLOR 255 255 0&nbsp; # highlight color is yellow<br>
END<br>
  <br>
###### LAYER C A T A S T O ###########<br>
LAYER<br>
&nbsp; NAME 'catasto'<br>
&nbsp; TYPE Polygon<br>
&nbsp; STATUS ON<br>
&nbsp; DATA 'lotti'<br>
#&nbsp; TEMPLATE index_basso.phtml<br>
&nbsp; LABELITEM 'PART_N'<br>
&nbsp; MAXSCALE 25000<br>
&nbsp; CLASS<br>
&nbsp;&nbsp;&nbsp; Name 'catasto'<br>
&nbsp;&nbsp;&nbsp; LABEL<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE TRUETYPE<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT time<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BUFFER 3<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 255 0 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSITION CC<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE 8<br>
&nbsp;&nbsp;&nbsp; END<br>
&nbsp;&nbsp;&nbsp; OUTLINECOLOR 100 255 000<br>
&nbsp; END&nbsp; # CLASS<br>
END&nbsp; # LAYER<br>
  <br>
######&nbsp; LAYER&nbsp;&nbsp; F O G L I&nbsp; ########<br>
LAYER<br>
&nbsp; NAME "fogli"<br>
&nbsp; TYPE Polygon<br>
&nbsp; STATUS ON<br>
&nbsp; DATA "fogli"<br>
&nbsp; LABELITEM 'FOGLIO_N'<br>
&nbsp; TEMPLATE header_1024.html<br>
&nbsp; CLASS<br>
&nbsp;&nbsp;&nbsp; Name 'foglio'<br>
&nbsp;&nbsp;&nbsp; TEXT (Foglio [FOGLIO_N])<br>
&nbsp;&nbsp;&nbsp; LABEL<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE TRUETYPE<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT time<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BUFFER 1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 0 0 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSITION auto <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE 10<br>
&nbsp;&nbsp;&nbsp; END<br>
&nbsp;&nbsp;&nbsp; OUTLINECOLOR 255 255 255<br>
&nbsp; END&nbsp; # CLASS<br>
END&nbsp; # LAYER fogli<br>
  <br>
END<br>
----------------------------------<br>
End of map file<br>
----------------------------------<br>
  <br>
  </tt><tt>Steve Lime wrote:</tt><br>
  <blockquote type="cite" cite="mids01fcfe4.004 at co5.dnr.state.mn.us">
    <pre wrap="">Are you escaping the value ('[PART_N]' IN '556,557' AND '[ID_N]' IN
'24') properly? Spaces aren't allowed and should be replaced with either
a + or a %20. We should still track down the source of the error though,
error 500's are never good.

Steve


Stephen Lime
Data &amp; Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

  </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap="">Roger Boily <a class="moz-txt-link-rfc2396E"
 href="mailto:boily at bsw.org">&lt;boily at bsw.org&gt;</a> 2/3/2004 6:33:11 AM &gt;&gt;&gt;
        </pre>
        </blockquote>
      </blockquote>
    </blockquote>
    <pre wrap=""><!---->Hi,

On a cgi url I've tried to query on multiple fields with this:
NB: for easy reading space and " are normals but I used %20(space) and

%27(')
&amp;qstring=('[PART_N]' IN '556,557' AND '[ID_N]' IN '24')
it works perfectly on windows Mapserver 4.0.1

But I receive error 500 from Apache on linux: (Premature end of script

headers: mapserv)
&amp;qitem=PART_N&amp;qstring=556 works fine on linux
but I receive the same error with:
&amp;qstring=('[PART_N]' IN '556')

Is there anyone who has any idea?

Is there a way to make multiple fileds query with qitem and qstring?

Thanks a lot

Roger


_______________________________________________
Mapserver-users mailing list
<a class="moz-txt-link-abbreviated"
 href="mailto:Mapserver-users at lists.gis.umn.edu">Mapserver-users at lists.gis.umn.edu</a> 
<a class="moz-txt-link-freetext"
 href="http://lists.gis.umn.edu/mailman/listinfo/mapserver-users">http://lists.gis.umn.edu/mailman/listinfo/mapserver-users</a>
  </pre>
  </blockquote>
</blockquote>
</body>
</html>

--------------030003020204010206030007--





More information about the mapserver-users mailing list