On Donnerstag, 23. April 2009 19:18:32 you wrote: Thanks to Steve and Arnd. This does the trick.
somevalue = "filter \"datum between '2002-8-8' and '2002-8-9'\""; Since i'am new to mapserver i was mislead by the docs and examples which use single and double qoutes freely. So i thought they are interchangeable. I cannot find a strict rule in the docs when to use single or double quotes. (Probably my blindness ...) Thanks for your help. Regards Heiko > The key is just making it look like a line in a mapfile. Your initial > tries used single quotes on a string > with internal single quotes. That would have broken a mapfile too. > Might want to post a summary > solution to your last message to the whole list. > > Steve > > >>> On 4/23/2009 at 8:01 AM, in message > > <[email protected]>, Heiko Schröter > > <[email protected]> wrote: > > On Donnerstag, 23. April 2009 14:34:00 you wrote: > > > > Steve you are genius. This works. > > Can we get this into the docs as well ? > > > > Thanks very much. > > Regards > > Heiko > > > >> What about trying? > >> > >> somevalue = "filter \"datum between '2002-8-8' and '2002-8-9'\""; > >> > >> The double quotes around the filter (containing single quotes) > > should > > >> please MapServer. > >> > >> Steve > >> > >> >>> Heiko Schröter <[email protected]> 04/23/09 2:46 > > AM > > >> On Mittwoch, 22. April 2009 18:07:11 you wrote: > >> > >> I've tested teh scenario with 3 different filter strings and > > attached > > >> the > >> mapserver error logs with DEBUG 5 (in case need be). > >> The resulting URL strings are taken from apache access log file. > >> Please let me know if you need the full URL. > >> > >> Thanks and Regards > >> Heiko > >> > >> > >> The OL call: > >> sacurabiglayer = new OpenLayers.Layer.WMS( "SACURABIG", > >> > >> "http://kahlo1/cgi-bin/mapserv", > >> > >> {map:'/home/schroete/sciadaten/MapServer/country98/heiko5.map', > >> layers: sacura_big, > >> "map.layer[SACURABIG]": > >> somevalue, > >> transparent: true}, > >> {singleTile:true, > >> isBaseLayer: false, > >> buffer:5, wrapDateLine: > >> true, > >> queryable: true}); > >> > >> Setting of the string in OL: > >> somevalue = "filter "+"'"+" datum between "+"'"+"2002-8-8"+"'"+" > > and > > >> "+"'"+" > >> 2002-8-9 "+"''"; > >> Results: > > MAP.LAYER%5BSACURABIG%5D=filter%20'%20datum%20between%20'2002-8-8'%20and%20 > > >>'%202002-8-9%20''& (ms_error_assembled_string.txt) > >> > >> Setting of the string in OL: > >> somevalue = "filter 'datum between '2002-8-8' and '2002-8-9' '"; > > MAP.LAYER%5BSACURABIG%5D=filter%20'datum%20between%20'2002-8-8'%20and%20'20 > > >>02-8-9'%20'& (ms_error_unescaped_string.txt) > >> > >> Setting of the string in OL: > >> somevalue = "filter 'datum between \'2002-8-8\' and \'2002-8-9\' > > '"; > > MAP.LAYER%5BSACURABIG%5D=filter%20'datum%20between%20'2002-8-8'%20and%20'20 > > >>02-8-9'%20'& (ms_error_escaped_single_quotes.txt) > >> > >> > >> The Mapfile Layer definition: > >> LAYER > >> CONNECTIONTYPE POSTGIS > >> NAME "SACURABIG" > >> PROCESSING "CLOSE_CONNECTION=DEFER" > >> OPACITY 60 > >> STATUS ON > >> METADATA > >> "wms_title" "sacurabig layer" > >> "wms_srs" "init=epsg:4326" > >> END > >> PROJECTION > >> "init=epsg:4326" > >> END > >> CONNECTION "user=fei password=foo dbname=fum > >> host=kahlo1" > >> DATA "geocenter from sacura_big" > >> VALIDATION > >> 'filter' "^." # Just for testing > >> END > >> FILTER "orbitnr=0" > >> TYPE POINT > >> SIZEUNITS meters > >> CLASS > >> NAME "sacura_big_class" > >> STYLE > >> COLOR [farbe] > >> SYMBOL "circle" > >> SIZE 35000 > >> END > >> END > >> END # Layer > >> > >> > What does the URL OL generate look like? I'm curious how it > > escapes > > >> the > >> > >> > text > >> > for the URL. That should give us a hint. > >> > > >> > Steve > >> > > >> > >>> Heiko Schröter <[email protected]> 04/21/09 > > 1:53 > > >> AM > >> > >> > Hello, > >> > > >> > i have to pass single quoted strings from Open Layer through > > mapserver > > >> > to a > >> > postgis/postgres database. > >> > > >> > i.e. "filter 'value=1 and datum between '2005-1-1' and '2005-1-3' > > "; > > >> > The postgres db expects (afaik) the date in a single quoted > > string. > > >> > The problem is that mapserver stops scanning the filter string > > when > > >> > coming > >> > across the second single quote and bails out. > >> > > >> > The Validation string in the mapfile: > >> > VALIDATION > >> > 'filter' "^." > >> > END > >> > > >> > Even when allowing single quotes explicitly by inserting escaped > >> > >> single > >> > >> > quotes > >> > in the validation string it doesn't work. Escaping the single > > quotes > > >> in > >> > >> > the > >> > assembled OL string won't help either. > >> > > >> > Does anyone has an idea of how to pass such strings through > > mapserver > > >> ? > >> > >> > Now i do use an ugly hack of converting the date to abstime on > > the > > >> > client side > >> > (with all the UTC converting hassle) and pass the integer to the > > db. > > >> > i.e. "filter 'value = 1 and abstime between "+fromDate+" and > >> > "+toDate+"'"; > >> > > >> > MapServer version 5.4.0-rc1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG > >> > OUTPUT=WBMP > >> > OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=ICONV > >> > SUPPORTS=WMS_SERVER > >> > INPUT=TIFF INPUT=EPPL7 INPUT=JPEG INPUT=POSTGIS INPUT=SHAPEFILE > >> > > >> > Thanks and Regards > >> > Heiko > >> > > >> > > >> > _______________________________________________ > >> > mapserver-users mailing list > >> > [email protected] > >> > http://lists.osgeo.org/mailman/listinfo/mapserver-users > > > > -- > > ----------------------------------------------------------------------- > > > Dipl.-Ing. Heiko Schröter > > Institute of Environmental Physics (IUP) phone: > > ++49-(0)421-218-4080 > > > Institute of Remote Sensing (IFE) fax: > > ++49-(0)421-218-4555 > > > University of Bremen (FB1) > > P.O. Box 330440 email: > > [email protected] > > > Otto-Hahn-Allee 1 > > 28359 Bremen > > Germany > > ----------------------------------------------------------------------- -- ----------------------------------------------------------------------- Dipl.-Ing. Heiko Schröter Institute of Environmental Physics (IUP) phone: ++49-(0)421-218-4080 Institute of Remote Sensing (IFE) fax: ++49-(0)421-218-4555 University of Bremen (FB1) P.O. Box 330440 email: [email protected] Otto-Hahn-Allee 1 28359 Bremen Germany ----------------------------------------------------------------------- _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
