[OpenLayers-Users] Blank WMS tiles displaying over Bing hybrid layer

Chris Lam clam_1982 at hotmail.com
Sat Jun 12 13:04:18 EDT 2010


Hello,

I am a newbie to OpenLayers and I have been for over a week having
difficulty getting my mapserver wms overlay to display over a Bing hybrid
base layer.  I know that commercial map providers like to use spherical
mercator srs code epsg:900913, while my wms layer is in epsg:4326 (WGS 84
datum).  I also am aware that my mapserver (server is localhost) serves the
wms layer as PNG image tiles, and that OpenLayers cannot reproject these
client-side.  I have been following this documentation: 
http://docs.openlayers.org/library/spherical_mercator.html, editing my ms4w
PROJ/epsg and mapfiles so that they recognize the 900913 srs.  I have
checked the mapfile with getcapabilities and it is aware of that projection. 
I have read other users cases as well but those are about wms layers being
stretched, slightly misaligned, or with missing tiles.  Mine is not
displaying at all, but upon right-clicking the map with the overlay turned
on in the layer switcher, I can view the blank 256x256 image and get that
tile's request URL.  I have found that if I paste this in a browser address
bar and change the SRS parameter back to its native 4326 and substitute the
BBOX with the extents found in my mapfile, I can get the wms data to appear
(the entire set of parcels are squeezed into a 256x256 tile).  It doesn't
seem to like the SRS and BBOX values after they have been converted into
900913 coordinates.

Here is my mapserver request URL from one tile:

http://localhost/cgi-bin/mapserv.exe?MAP=C%3A%2Fms4w%2Fapps%2FLB_MAPFILES%2FPARCELS_MAPFILE.map&LAYERS=PARCELS_URL_pol&TRANSPARENT=true&DISPLAYPROJECTION=EPSG%3A4326&ISBASELAYER=false&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&SRS=EPSG%3A900913&BBOX=-13719529.331192,6352222.7966734,-13718306.33874,6353445.7891258&WIDTH=256&HEIGHT=256

Here is my relevant code:

function init () {
//Configure map
     var options = {
          projection: new OpenLayers.Projection("EPSG:900913"),
          units: "m",
          maxResolution: 156543.0339
          maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34)};
//Create new map object
     var map = new OpenLayers.Map('map',options);
//Add a layerswitcher
     map.addControl(new OpenLayers.Control.LayerSwitcher());
//Add the Bing map base layer
     var vemap = new OpenLayers.Layer.VirtualEarth("Virtual Earth",
        { type: VEMapStyle.Hybrid,
           sphericalMercator: true,
           numZoomLevels: 21,
           maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
         });
//Add the WMS parcels overlay layer
     var parcels_wms = new OpenLayers.Layer.WMS(
                    "Lions Bay Parcels",
                    "http://localhost/cgi-bin/mapserv.exe?",
                    {
                     map: 'C:/ms4w/apps/LB_MAPFILES/PARCELS_MAPFILE.map',
                     layers: 'PARCELS_URL_pol',
                     transparent: 'true',
                     displayProjection: new
OpenLayers.Projection("EPSG:4326"),
                     isBaseLayer: false,
                     maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)},
                    {
                      visibility:false
                    }
                 );
//Add the layers to the map object
map.addLayers([vemap,parcels_wms]);
//Center the map over the study area
map.setCenter(new OpenLayers.LonLat(-13718569,6353226), 14);

...the rest of the code is other map controls, layer opacity adjuster, and
single-click mouse event handler containing a getfeatureinfo request.

This code seems to be fine, but am I doing something wrong with setting max
extent or max resolution?  The Bing map itself centers and zooms the way I
want, but the WMS data is failing to align with it.  Perhaps it could be
displayed outside of the extents and therefore not rendered at all?  Or is
this a mapserver problem where my server is not requesting tiles in
epsg:900913 to align with Bing tiles?  In another web template where I have
not implemented the links to Bing maps, my wms layer displays fine since the
map projection is 4326 and not 900913.  That template has a line of code
map.zoomToMaxExtent(); that, when commented out, makes the working overlay
disappear completely.  Don't know if that is a helpful clue.

I have tried starting from a basic html template to add code line by line to
isolate the problem.  It works fine until I add the Bing layer which just
wipes out the previously displayed WMS parcel layer to just display the Bing
hybrid with the overlay present, but rendered completely as blank 256x256
tiles.

Thank you for any advice, for I am out of leads!

Regards,

Chris Lam

P.S. If this is a duplicate posting, you have my sincere apologies for the
lapse in etiquette.  At the time of this message, I was not subscribed to
the mailing list and I think you have to be for messages to be accepted. 
Also I did not see my message in the users archive or on the Nabble forum
where I found this list.  Thank you for your understanding.
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Blank-WMS-tiles-displaying-over-Bing-hybrid-layer-tp5172086p5172086.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list