[Mapserver-users] Querying on multiple fields

Steve Lime steve.lime at dnr.state.mn.us
Wed Feb 4 14:13:16 PST 2004


You shouldn't need qitem in either system, so it must not be being
initialized properly someplace. I checked the source and it looks like
doing an strdup on a NULL value must be the culprit on some platforms. I
just checked a fix into the development tree.

Steve

>>> Roger Boily <boily at bsw.org> 2/4/2004 2:33:06 AM >>>
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 
>>  
>>



More information about the MapServer-users mailing list