Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

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).

share|improve this answer
    
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. –  Fran Verona Feb 5 '11 at 11:20
    
shouldn't need an update. –  iant Feb 5 '11 at 16:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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