3

I need to add an overlay layer that uses EPSG:4326 to a map with a base layer that uses EPSG:32628.

Every time I add the overlay OpenLayers automatically switches the SRS param of the overlay to EPSG:32628 (SRS of baselayer); I can see the base layer, but the overlay isn't shown.

My code is this:

baselayer = new OpenLayers.Layer.WMS(
               baselayername, baselayerurl,
               {
                  width: varmap.size.w,
                  srs: 'EPSG:32628',
                  layers: baselayername,
                  height: varmap.size.h,
                  styles: style,
                  format: format
               }
               );

overlaylayer = new OpenLayers.Layer.WMS(
               overlaylayer name, overlaylayer url,
               {
                  width: varmap.size.w,
                  srs: 'EPSG:4326',
                  layers: layername,
                  height: varmap.size.h,
                  styles: style,
                  format: format,
                  transparent: true
               }
               );

varmap.addLayers([baselayer,overlaylayer]);

How can I do this?

1 Answer 1

7

That is how it is supposed to work. OpenLayers can't reproject WMS layers for you so you should let the WMS server take care of that for you.

If your WMS can not support EPSG:32628 then you will need to look into setting up a cascading WMS that can reproject it for you (both MapServer and GeoServer 2.1+ can do this).

2
  • Thanks for your response. I told your answer to my technical OGC and he told me that he's going to update the OGC servers to GeoServer 2.1. Commented Feb 5, 2011 at 11:20
  • shouldn't need an update.
    – Ian Turton
    Commented Feb 5, 2011 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.