[mapserver-users] Bug? map_layer_filter

Lowther, David W dlowther at ou.edu
Tue Oct 29 09:58:11 EST 2002


Bjarni,

I have tried a couple more things.

1) 
<input name="map_sqlParcel_data" value="the_geom from (select oid,* from
a047parcel where pnum in
('0000-29-24N-05W-3-100-00','0000-30-24N-05W-4-100-00')) as foo">

works fine.

2) 
<input type=hidden name="map_sqlParcel_data" value="the_geom from (select
oid,* from a047parcel) as foo">
<input type=hidden name="map_sqlParcel_filter" value="pnum in
('0000-29-24N-05W-3-100-00','0000-30-24N-05W-4-100-00')">

fails with error:
msPOSTGISLayerWhichShapes(): Query error. prep_DB:Error executing POSTGIS
DECLARE statement (0.6 failed - retried 0.5 and it failed too). DECLARE
mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from (select
oid,* from a047parcel) as foo WHERE (pnum in ) and (the_geom && setSRID(
'BOX3D(-98.1769012540527 36.1434604724575,-97.4028596973514
36.6100900285963)'::BOX3D,find_srid('','a047parcel','the_geom') )) 

Aren't 1 and 2 essentially doing the same thing? Do you think this is a bug?

Dave


-----Original Message-----
From: Bjarni Pjetursson [mailto:Bjarni.Pjetursson at tietoenator.com]
Sent: Tuesday, October 29, 2002 8:56 AM
To: 'Lowther, David W'
Cc: mapserver-users at lists.gis.umn.edu
Subject: SV: [mapserver-users] map_layer_filter


Hi Dave,
In this case, you'll have to use javascript to quote your string correctly:

function onPageLoad() {
      if (document.mapserv.map_layername_filter.value.substring(0,1) !=
"\"") {
          document.mapserv.map_layername_filter.value = '"' +
document.mapserv.map_layername_filter.value + '"';
      }

Place this function in the head of your template and call it with an onLoad
trigger in the body-tag.

This will place your string in double-plings IF it not already is. (Not
pretty - but it works.)

Regards
Bjarni Thor Pjetursson

> -----Oprindelig meddelelse-----
> Fra:	Lowther, David W [SMTP:dlowther at ou.edu]
> Sendt:	29. oktober 2002 15:30
> Til:	Bjarni Pjetursson; Lowther, David W
> Cc:	mapserver-users at lists.gis.umn.edu
> Emne:	RE: [mapserver-users] map_layer_filter
> 
> Bjarni,
> 
> I'm not sure how to do this with a more complex filter like:
> 
> "pnum in ('3400-00-001-001-0-001-00','3400-00-001-001-0-002-00')"
> 
> What would you set the value of map_layername_filter to for the above
> filter?
> 
> It seems from some further investigation that there are several characters
> that will cause the filter to be truncated ',(,_ 
> Are there others? 
> Is there any way around this?
> 
> Thanks for your help,
> 
> Dave
> 
> -----Original Message-----
> From: Bjarni Pjetursson [mailto:Bjarni.Pjetursson at tietoenator.com]
> Sent: Tuesday, October 29, 2002 3:34 AM
> To: 'Lowther, David W'
> Cc: mapserver-users at lists.gis.umn.edu
> Subject: SV: [mapserver-users] map_layer_filter
> 
> 
> Try quoting your field with both single-plings and double-plings like this
> <input type="text" name="map_layername_filtername" value='"conditions"'>
> Regards
> Bjarni Thor Pjetursson
> 
> > -----Oprindelig meddelelse-----
> > Fra:	Lowther, David W [SMTP:dlowther at ou.edu]
> > Sendt:	28. oktober 2002 21:56
> > Til:	Mapserver-Users (E-mail)
> > Emne:	[mapserver-users] map_layer_filter
> > 
> > Howdy List,
> > 
> > I'm trying to pass in a setting for map_layer_filter from a form. It
> looks
> > something like this:
> > 
> > <form method="post" action="http://domain/cgi-bin/mapserv.exe"
> target=map
> > name="Master">
> > 	<input type=hidden name="map" value="something.map">
> > 	<input type=hidden name="map_sqlParcel_filter" value="pnum in
> > ('3400-00-001-001-0-001-00','3400-00-001-001-0-002-00')">
> > 	<input type=hidden name=layers value="cnty_poly sqlParcel">
> > </form>
> > 
> > The layer comes from PostGIS and everything works fine when set the
> filter
> > in the mapfile. I get an error that looks like this:
> > 
> > msPOSTGISLayerWhichShapes(): Query error. prep_DB:Error executing
> POSTGIS
> > DECLARE statement (0.6 failed - retried 0.5 and it failed too). DECLARE
> > mycursor BINARY CURSOR FOR SELECT
> > asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from
> > (select
> > oid,* from a047parcel) as foo WHERE (pnum in ) and (the_geom && setSRID(
> > 'BOX3D(-98.1769012540527 36.1434604724575,-97.4028596973514
> > 36.6100900285963)'::BOX3D,find_srid('','a047parcel','the_geom') )) 
> > 
> > My best guess is that this has something to do with the quotation marks
> > coming from the form. Does anybody have any ideas on this one?
> > 
> > Thanks for your help.
> > 
> > David Lowther



More information about the mapserver-users mailing list