[OpenLayers-Users] WMS overlaid on Google "spherical mercator" in OpenLayers

ahm126 a_murdoch at hotmail.com
Tue Jan 8 09:44:03 EST 2008


I got a few responses, but nobody has solved my problem yet.  I seem to be
struggling with similar problems that Maria Panagou and Linda Rawson were
having earlier.  

Is there a way to get WMS services rendered through Geoserver 1.6RC2
(currently running on localhost) to display over Google (or other
commercial) background data?  It seems that was the the whole impetus behind
creating the "sphericalMercator" functionality and providing the
"spherical-mercator.html" example.  However, I've tried really hard to get
this working and failed so far.  

I don't know what else I can try at this point.  I've tried
adding/changing/removing the maxExtent and maxResolution from the map
declaration and from the layer declarations, without results.

The Google layer shows up perfectly.  I can partially see my WMS layers, but
they are "cut-off" by two vertical lines through the eastern US and Siberia. 
Europe and Asia display fine, but North and South America are missing.

Let me know what further info I can provide to help figure this out!

Thanks!
Andrew

Here is part of the code I'm using (based on the spherical-mercator.html
example page:

	var bounds = new OpenLayers.Bounds(-20037508, -20037508,
                                                 20037508, 20037508.34);
        function init(){
            var options = {
                projection: "EPSG:900913",
                units: "m",
		numZoomLevels: 18,
                maxExtent: bounds
	    };
            map = new OpenLayers.Map('map', options);

            // create Google Mercator layers
           var gmap = new OpenLayers.Layer.Google(
                "Google Streets",
                {'sphericalMercator': true}
            ); 

       	var layer1 = new OpenLayers.Layer.WMS(
            "Countries", "http://127.0.0.1:8080/geoserver/wms",
            {
              layers: 'topp:ahm_countries',
              styles: '',
  	      transparent: true,
              format: 'image/png'
            },
            {
		  maxExtent: bounds,
    		  maxResolution: "auto",
                  isBaseLayer: false, 
		  displayOutsideMaxExtent: true,
		  wrapDateLine: true
			} 
          );
	  
	var states_wms = new OpenLayers.Layer.WMS(
                "TOPP States",
                "http://localhost:8080/geoserver/wms?",
                {
                   layers: 'topp:states',
                   styles: '',
                   srs: 'EPSG:4326',
                   format: 'image/png',
                   transparent: true
                },
                {
                    opacity: 0.75, 
		    isBaseLayer: false, 
		    displayOutsideMaxExtent: true, 
		    wrapDateLine: true
                }
            );
			
            map.addLayers([gmap, layer1, states_wms]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.MousePosition({element:
$('position')}));
            map.zoomToMaxExtent()




ahm126 wrote:
> 
> 
> 
> 
> Hello,
> 
> I'm cross-posting to the Geoserver and OpenLayers lists with this
> question.
> 
> I'm using Geoserver 1.6.0 RC2 and OpenLayers 2.5 with Firefox 2.0.0.11. 
> I'm trying to display a WMS layer overtop of Google background data using
> the OpenLayers javascript client.  The Google data shows up fine and I'm
> getting the topp:states WMS layer from Geoserver to show up, but only half
> of the WMS states features show up at zoom level 1.  Only the eastern
> states show up with a vertical line cutting north to south.  When I zoom
> in closer on the US, all the WMS features show up overlain on the Google
> data.  It's almost as if at small "world-wide" scales, there are too many
> tiles to display and the WMS is only partially displayed.
> 
> I've duplicated this behavior with other WMS layers from my Geoserver
> installation.  At small "world-wide" scales, the WMS data is cut off. 
> When you zoom in, the WMS is displayed normally.
> 
> I've been using a modified copy of the "spherical-mercator.html" example
> to get this far.  I can send in javascript code or screenshots if that
> would be helpful.
> 
> Thanks for your help!!
> Andrew
> 
> _________________________________________________________________
> i’m is proud to present Cause Effect, a series about real people making a
> difference.
> http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/WMS-overlaid-on-Google-%22spherical-mercator%22-in-OpenLayers-tp14584062p14691039.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list