[mapserver-users] RE: No filter defined on itemquery
Ryan, Adam
ARyan at co.linn.or.us
Thu Jun 27 09:30:24 PDT 2002
Tyler, Daniel, et al.
My method may be weird but this is what I do:
With javascript I set some hidden inputs when the user wants to search:
mapserv.qlayer.value = theqlayer;
mapserv.mode.value = "itemnquery";
mapserv.mapext.value = "shapes";
mapserv.item.value = theitem;
mapserv.value.value = theitemstring;
the variables:
'theqlayer' is the layer the user picks to search.
'theitem' is the DBase field the user picks.
'itemstring' is the modification of the user's text input with the necessary
punctuation. I make it a regular expression which both CGI variables
"filteritem" and "value" can handle, i.e. /^12345$/.
Then, I have two other hidden inputs (among many others) in my mapserv form:
<input type="hidden" name="thislayer_filteritem" value="">
<input type="hidden" name="thislayer_filter" value="">
With javascript, I set both the VALUE and then the NAME of these hidden
inputs:
mapserv.thislayer_filteritem.value = theitem;
mapserv.thislayer_filteritem.name = "map_"+theqlayer+"_filteritem";
mapserv.thislayer_filter.value = theitemstring;
mapserv.thislayer_filter.name = "map_"+theqlayer+"_filter";
(obviously you have to set the name AFTER the value - it's tough to
reference it after the name changes.)
Then I submit the form. This may be a stupid way to do it but it works.
What's cool is that you don't need to mess with filter, filteritem,
classitem or expression in your map file. You send these as CGI variables
on demand.
I STILL DON'T KNOW HOW TO USE MULTIPLE ITEMS IN A QUERY!!!!!!!!!!!!!!
Hope this helps,
Adam
-----Original Message-----
From: Tyler Mitchell [mailto:TMitchell at lignum.com]
Sent: Thursday, June 27, 2002 8:54 AM
To: DMartin at erac.com
Cc: ARyan at co.linn.or.us
Subject: RE: No filter defined on itemquery
Hi Daniel,
I'm trying to get itemquery going now too and I saw your previous posting
on your problems. Did you get them fixed, there appeared to be no followup
to your question at:
http://mapserver.gis.umn.edu/wilma/mapserver-users/0206/msg00225.html
>From what I understand the layer's filteritem has to be set to the field
name (i.e. FILTERITEM ZIP) from the dbase file and then, it looks like you
may need to set the filter to something like (FILTER "%value%") so that
when it gets passed through your URL it will substitute it in there and
THEN generate the map.
I really want to do the same thing as outlined at
http://maps.dnr.state.mn.us/mapserver_demos/tests/itemquery/test.html in
Case 1 - simple itemquery, using a drop-down list. Are you able to do this
yet? If so, would you be able to share your html and map files with me.
I'd like to document how to put this stuff together, once I understand of
course :)
Tyler
RE: [mapserver-users] No filter defined on itemquery.
To: "'Ryan, Adam'" <ARyan at co.linn.or.us>, "'
mapserver-users at lists.gis.umn.edu'" <
mapserver-users at lists.gis.umn.edu>
Subject: RE: [mapserver-users] No filter defined on itemquery.
From: "Martin, Daniel" <DMartin at erac.com>
Date: Tue, 11 Jun 2002 11:57:51 -0500
Thanks for the quick reply.
Please forgive me, I'm fairly new at this. I'm not clear on two things. I
assume when you say "your item", the item is the DBASE item? And second,
how can I set the FILTER in the mapfile to the value, when the value is to
be entered by the user?
Thanks again,
Dan
-----Original Message-----
From: Ryan, Adam [mailto:ARyan at co.linn.or.us]
Sent: Tuesday, June 11, 2002 11:33 AM
To: Martin, Daniel; 'mapserver-users at lists.gis.umn.edu'
Subject: RE: [mapserver-users] No filter defined on itemquery.
I struggled through the same thing. The solution is to set the
layer's filter and filteritem to your value and item respectively,
but I don't understand why either. Watch for punctuation.
Adam
-----Original Message-----
From: Martin, Daniel [mailto:DMartin at erac.com]
Sent: Tuesday, June 11, 2002 7:17 AM
To: 'mapserver-users at lists.gis.umn.edu'
Subject: [mapserver-users] No filter defined on itemquery.
When I try to itemquery a Postal Code layer, I get:
msQueryByAttributes(): Query error. Requested layer has no
filter defined.
My URL looks like this:
http://myserver/cgi-bin/mapserv.exe?map=d%3A%5CMapServer%5CMAPFiles%5CMOMap.
map&program
%2Fcgi-bin%2Fmapserv.exe&map_web_imagepath=d%3A%5Cinetpub%5Cwwwroot%5Ctemp%5
C&map_web_imageurl
%2Ftemp%2F&mode=itemquery&value=63105&qlayer=Zip+Codes&item=ZIP&mapext=shape
s
I've included the layer definition at the bottom of this email.
I don't understand. Why do I need a filter? What filter do I
need? I've read everything about this I could find before
asking you, but the documentation on FILTER is very brief, and
the mail archives didn't provide a solution. I should point
out that I'm using OGR MapInfo TAB data.
Thanks in advance,
Dan Martin
LAYER
NAME "Zip Codes"
PROJECTION
"proj=latlong"
END
CONNECTIONTYPE OGR
CONNECTION "\GISData\Namerca\USA\Usa_Maps\USZIPBdy.TAB"
TYPE POLYGON
STATUS OFF
LABELITEM "ZIP"
CLASS
SYMBOL 'circle'
SIZE 2
NAME 'ZIP Code Boundaries'
OUTLINECOLOR 50 50 50
COLOR -1 -1 -1
LABEL
POSITION cc
TYPE TRUETYPE
FONT arial_narrow
MINSIZE 8
MAXSIZE 12
COLOR 0 0 0
OUTLINECOLOR 255 255 255
ANTIALIAS true
END
END
TEMPLATE "..\queryTemplates\US_ZIP_Code_query.html"
END
Prev by Date: Re: [mapserver-users] Big CVS Update
Next by Date: RE: [mapserver-users] Big CVS Update
Index(es):
Chronological
Thread
More information about the MapServer-users
mailing list