[Mapserver-users] Querying on multiple fields

Roger Boily boily at bsw.org
Wed Feb 4 00:33:06 PST 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 <'[FIELD]'=value>,
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?&map=/var/www/html/sittel/procida/urbis.map&layer=fogli&mapext=shapes&mode=itemnquery&qlayer=fogli&qstring=%28">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=FOGL</a></tt><tt><a
 class="moz-txt-link-freetext"
 href="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=%28">IO_N&qstring=</a></tt><a
 class="moz-txt-link-freetext"
 href="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=%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>&qstring=('[PART_N]'
IN '556') does not<br>
work. It works fine with &qitem=PART_N&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?&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&qitem=FOGLIO_N&qstring=10</a><br>
  <a class="moz-txt-link-freetext"
 href="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=%28">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=(</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>
  TEMPLATE header_1024.html<br>
  IMAGEPATH '/var/www/html/tmp/'<br>
  IMAGEURL '/tmp/'<br>
  MINSCALE 100<br>
END  #WEB<br>
  <br>
QUERYMAP<br>
  STATUS ON<br>
  STYLE HILITE<br>
  COLOR 255 255 0  # highlight color is yellow<br>
END<br>
  <br>
###### LAYER C A T A S T O ###########<br>
LAYER<br>
  NAME 'catasto'<br>
  TYPE Polygon<br>
  STATUS ON<br>
  DATA 'lotti'<br>
#  TEMPLATE index_basso.phtml<br>
  LABELITEM 'PART_N'<br>
  MAXSCALE 25000<br>
  CLASS<br>
    Name 'catasto'<br>
    LABEL<br>
      TYPE TRUETYPE<br>
      FONT time<br>
      BUFFER 3<br>
      COLOR 255 0 0<br>
      POSITION CC<br>
      SIZE 8<br>
    END<br>
    OUTLINECOLOR 100 255 000<br>
  END  # CLASS<br>
END  # LAYER<br>
  <br>
######  LAYER   F O G L I  ########<br>
LAYER<br>
  NAME "fogli"<br>
  TYPE Polygon<br>
  STATUS ON<br>
  DATA "fogli"<br>
  LABELITEM 'FOGLIO_N'<br>
  TEMPLATE header_1024.html<br>
  CLASS<br>
    Name 'foglio'<br>
    TEXT (Foglio [FOGLIO_N])<br>
    LABEL<br>
      TYPE TRUETYPE<br>
      FONT time<br>
      BUFFER 1<br>
      COLOR 0 0 0<br>
      POSITION auto <br>
      SIZE 10<br>
    END<br>
    OUTLINECOLOR 255 255 255<br>
  END  # CLASS<br>
END  # 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 & 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"><boily at bsw.org></a> 2/3/2004 6:33:11 AM >>>
        </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(')
&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
<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