0
votes

I am developing a website using OpenLayers and need to put various WMS sources ontop of a background map.

I have a problem with an overlay WMS layer not being shown when zooming in on the map. The problem seem to only occur when using a background WMS Layer in EPSG:900913. I have created a demonstration page available here:

http://andarki.dk/Stackoverflow/OpenLayers/WMS.html

Both maps are identical, except for the background map. The left map is using a Background map in EPSG:4326, while the right background map is using EPSG:900913. If you zoom in, you will notice that the Nexrad layer only stays visible at the left map.

If you look at the two requests being sent to the Nexrad server for the second map, the BBOX is wrong:

Request1: BBOX=-5009557.0848,-90.000000001863,-179.99999999814,5009287.0848

Request2: BBOX=-179.99999999814,-90.000000001863,5009197.0848,5009287.0848

These coordinates (in EPSG:900913) corresponds to Africa, not North America as expected.

2

2 Answers

1
votes

The problem was caused by not having set maxExtent on the map. The following code makes it work:

mapWorking900913 = new OpenLayers.Map
(
    "mapWorking900913",
    {
        maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
    }
);

The coordinates used in maxExtent must be in the same srs as the background map. If more background maps are needed, that must all be in the same srs.

0
votes

If you take a look at Capabilites document(http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities) of WMS service you will see that it actually supports both 4326 and 900913.

I would try to set projection explicitly on the map that uses OpenStreetMaps:

mapBroken = new OpenLayers.Map("mapBroken", {
projection : "EPSG:900913",
maxResolution:2319.89824519781,
units:'m' });