[OpenLayers-Users] Fwd: Unsetting request parameters

Erik Uzureau euzuro at gmail.com
Tue Jul 25 09:50:17 CDT 2006


Gosh, Jon, I'm sorry. I told you to do the wrong thing.

instead of specifying "projection" in the default parameters,
it needs to be specified in the options... or directly tagged on
as a parameter to the layer.

You see, items in the parameters list just get processed and
directly added to the httprequest. We chose to make a
"projection" option, however, so that we could later change
the parameter to which it translates (ie in the case of the
wms 1.3 where instead of srs, it is now crs -- in theory,
this would be handled by smart-code)

I tried this on my machine and it seemed to work (at least
in so far as not sending the SRS parameter anymore... :-)

--erik

OpenLayers.Layer.WMS1_3 = Class.create();
OpenLayers.Layer.WMS1_3.prototype =
  Object.extend( new OpenLayers.Layer.WMS(), {

    /** @final @type hash */
    DEFAULT_PARAMS: { service: "WMS",
                      version: "1.3.0",
                      request: "GetMap",
                      styles: "",
                      exceptions: "XML",  // todo, should be INIMAGE
                      format: "image/png",
                      crs: "CRS:84"
                     },

  projection: "none",

  ...








> > On 7/25/06, jdb at mail.nerc-essc.ac.uk <jdb at mail.nerc-essc.ac.uk> wrote:
> > > Hi Erik,
> > >
> > > Thanks, but I'm afraid this doesn't work - I get the
> > following request string:
> > >
> > > ...&CRS=CRS:84&PROJECTION=none&SRS=EPSG:4326&BBOX=...
> > >
> > > I tried setting "projection: null" as well but this produced:
> > >
> > > ...&CRS=CRS:84&SRS=EPSG:4326&BBOX=...
> > >
> > > as before.
> > >
> > > Cheers, Jon
> > >
> > > Quoting Erik Uzureau <euzuro at gmail.com>:
> > >
> > > > Hi Jon,
> > > >
> > > > If you are using the svn HEAD version, the way to disable the svn
> > > > parameter is by setting the option "projection" to "none"
> > > > ...
> > > >
> > > > ie:
> > > >
> > > > OpenLayers.Layer.WMS1_3.prototype =
> > > >  Object.extend( new OpenLayers.Layer.WMS(), {
> > > >
> > > >    DEFAULT_PARAMS: { service: "WMS",
> > > >                      version: "1.3.0",
> > > >                      request: "GetMap",
> > > >                      styles: "",
> > > >                      exceptions: "INIMAGE",
> > > >                      format: "image/png",
> > > >                      crs: "CRS:84",
> > > >                      projection: "none"
> > > >                     },
> > > >
> > > >
> > > > let me know if that works out alright for you... :-) erik
> > > >
> > > > On 7/24/06, Jon Blower <jdb at mail.nerc-essc.ac.uk> wrote:
> > > >> Hi all,
> > > >>
> > > >> I've created a very simple Layer type for Web Map Servers using
> > > >> version 1.3.0.  This is very similar to the existing WMS layer
> > > >> type, which is for WMS1.1.1.  My code for the WMS1.3
> > layer looks like this:
> > > >>
> > > >> OpenLayers.Layer.WMS1_3 = Class.create();
> > > >> OpenLayers.Layer.WMS1_3.prototype =
> > > >>   Object.extend( new OpenLayers.Layer.WMS(), {
> > > >>
> > > >>     DEFAULT_PARAMS: { service: "WMS",
> > > >>                       version: "1.3.0",
> > > >>                       request: "GetMap",
> > > >>                       styles: "",
> > > >>                       exceptions: "INIMAGE",
> > > >>                       format: "image/png",
> > > >>                       crs: "CRS:84"
> > > >>                      },
> > > >>
> > > >>     CLASS_NAME: "OpenLayers.Layer.WMS1_3"
> > > >> });
> > > >>
> > > >> This works fine, but there's a minor bug.  Note that the
> > coordinate
> > > >> reference systems is now specified by the "CRS"
> > parameter, not the "SRS"
> > > >> parameter that is used in WMS1.1.1.  The URLs that are generated
> > > >> for the call to the GetMap function look like this:
> > > >>
> > > >>
> > &SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&STYLES=&EXCEPTIONS=INIMAG
> > > >> E &FORMAT=image/png&CRS=CRS:84&SRS=EPSG:4326&BBOX=...
> > > >>
> > > >> Note that the "CRS" and "SRS" parameters both appear in
> > the URL.
> > > >> This doesn't really matter because the "SRS" parameter
> > is ignored
> > > >> by WMS1.3 servers.  However, for the sake of neatness,
> > is there a way of "unsetting"
> > > >> the SRS parameter so that it doesn't appear in the URL?  I tried
> > > >> setting
> > > >> "SRS: null" in the DEFAULT_PARAMS section of the above code but
> > > >> that didn't seem to work.
> > > >>
> > > >> Thanks in advance,
> > > >> Jon
> > > >>
> > > >>
> > > >> --------------------------------------------------------------
> > > >> Dr Jon Blower              Tel: +44 118 378 5213 (direct line)
> > > >> Technical Director         Tel: +44 118 378 8741 (ESSC)
> > > >> Reading e-Science Centre   Fax: +44 118 378 6413
> > > >> ESSC                       Email: jdb at mail.nerc-essc.ac.uk
> > > >> University of Reading
> > > >> 3 Earley Gate
> > > >> Reading RG6 6AL, UK
> > > >> --------------------------------------------------------------
> > > >>
> > > >>
> > > >> _______________________________________________
> > > >> Users mailing list
> > > >> Users at openlayers.org
> > > >> http://mailman-viper.python-hosting.com/listinfo/users
> > > >>
> > > >
> > >
> > >
> > >
> > > ----------------------------------------------------------------
> > > This message was sent using IMP, the Internet Messaging Program.
> > >
> > >
> >
>
>
>


More information about the Users mailing list