[OpenLayers-Users] WMS SRS:EPSG4326 with OpenLayers doesn´t work

Andreas Hocevar ahocevar at opengeo.org
Wed Oct 7 03:58:01 EDT 2009


Bytechanger wrote:
> I want add a baselayer from WMS in EPSG 4326
> but this doesn´t work!
>
> 1.
>    map=new OpenLayers.Map('map', { projection: new
> OpenLayers.Projection("EPSG:4326"), ...);
>   

Ok, although EPSG:4326 is the default so you do not need to set it.

> 2. var TestLayer= new OpenLayers.Layer.WMS("Test", "http://www.geo
> ....?", { REQUEST: 'getMap', SRS:'EPSG:4326' ...},{isBaseLayer:true});
>   

Don't add REQUEST and SRS params -- OpenLayers will do that for you. But
make sure to add a LAYERS param.

> map.addLayer(TestLayer);
>
> But I don´t see anything !! No mapdata....
>   

You have to zoom to an extent first to see something:

map.zoomToMaxExtent();

Also look at one of the examples (e.g.
http://openlayers.org/dev/examples/lite.html) to see how this works.

> when I want to get the WMS-Request...
>   TestLayer.getURL(map.Extent());
>   

Extent() is not a method of the map, so what you are trying to do here
cannot work.

> I get wrong EPSG !!!! the Request inherits:  &SRS=EPSG%3A4326   <- RIGHT!
>                                                                   
> &BBOX=-76506.698386357, and so on  <- WRONG Coordinate Format!!!!!!
>
> map.Extent() returns also the wrong format !!!!!!!!
>   

map.Extent() will raise an exception. Did you mean map.getExtent()?

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list