[OpenLayers-Users] WMS - Problem with projection param in WMS request

Guillaume Sueur guillaume.sueur at neogeo-online.net
Thu Mar 13 11:27:47 EDT 2008


Thanks Christopher, this is very helpful. I'm going to test it right away.

Indeed, these 2 projections strings are the same, the 27582 is 
deprecated (don't know why...) but still in use on some servers, which 
don't include 27572.

Even if this situation is quite abnormal, and should be fixed on WMS 
servers side (by adding 27572), it would be helpful if OL could handle 
it. So as you suggested, I will open a ticket if I can fix it with your 
piece of code.

Regards,

Guillaume

Christopher Schmidt a écrit :
> On Thu, Mar 13, 2008 at 04:05:46PM +0100, Guillaume Sueur wrote:
>> Hi list,
>>
>> I'm using openlayers from trunk.
>>
>> I'm setting up a map with 3 different WMS layers.
>> Map projection -> projection: "EPSG:27572"
>> Layer 1 and layer 2 are the same, so specific option is added to their 
>> layer definition, and they come up in 27572, which is good.
>>
>> layer3 must be called with EPSG:27582 (which is deprecated, but it's the 
>> way the WMS server is set)
>> so I add : projection:"EPSG:27582" to the layer's options.
>>
>> BUT, when the WMS request is made, it is SRS=EPSG:27572 which is sent. I 
>> thought my layer was misconfigured, but I tried deleting the 2 others :
>> with only layer3, the WMS request is then correct with srs=EPSG:27582
>>
>> with 3 layers, the strange behaviour is the same regardless the order in 
>> which the layers are set up...
> 
> OpenLayers does not support the display of differently projected WMS
> layers. I'm assuming that in this case, your two different projection
> strings have the same projection, and that this isn't actually two
> different projections like OpenLayers tries to helpfully assume it is.
> If that's the case, then the code to modify is the getFullRequestString
> function: specifically, doing something like this:
> 
> OpenLayers.Layer.WMS.prototype.getFullRequestString =
>           function(newParams, altUrl) {
>     var projectionCode = this.projection.toString();
>     this.params.SRS = (projectionCode == "none") ? null : projectionCode; 
>     return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
>       this, arguments);
> }
> 
> Before you craft your Layer.
> 
> Note that this is overriding the behavior of a non-API method, and may 
> not work 'long term': I suggest that if this solves your problem that
> you open a ticket for 2.7 describing this lack of functionality.
> 
> Regards,





More information about the Users mailing list