[OpenLayers-Users] OSM and WMS problem using correct maxExtent, maxResolution and projection

Gabriele Seitz ml-seitz at web.de
Thu Sep 8 12:02:59 EDT 2011


Hi,

i cannot get the features of my WMS onto the OSM-Map. THe nearest i can get
is this approach with the features laying in "Gulf of Guinea".
I need them in Germany, though.

Geoserver Layer-preview of WMS in firebug-DOM-tab shows: 
- maxExtent=left-bottom=(6.798,48.141) right-top=(13.705,54.325), 
- maxResolution=0.02698046875, 
- projection=EPSG:900913

OSM layer-Properties in Firebug -DOM information show:
- maxExtent=left-bottom=(-20037508.3392,-20037508.3392)
right-top=(20037508.3392,20037508.3392),
- maxResolution =156543.0339, 
- projection=EPSG:900913

Code:

        function init(){
		var extent=new OpenLayers.Bounds(6,48,13,55);
		var options = {
			//controls: [],
			maxExtent: extent
			,maxRsolution: 0.02698046875
			,projection:"EPSG:900913"
		};
		map = new OpenLayers.Map('map', options); 

		var osm= new OpenLayers.Layer.OSM("Basis Open Street Map");
		var flaglayer = new OpenLayers.Layer.WMS(
			"basic:gis_elemente",
"http://geoserver.domain.com:80/geoserver/basic/wms",
			{
				layers: 'basic:gis_elemente',
				transparent:true,
				projection: "EPSG:900913"
			}
		);
		map.addLayers([ osm,flaglayer]); 
		
		map.addControl(
			new OpenLayers.Control.LayerSwitcher(
				{'div':OpenLayers.Util.getElement('layerswitcher')}
			)
		);
		map.addControl(new OpenLayers.Control.MousePosition());
		map.zoomToExtent(extent);	
	}

How do I fit maxExtent and maxResolution to show OSM and WMS correctly? 

Thanks for answering.

Gabriele 	

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/OSM-and-WMS-problem-using-correct-maxExtent-maxResolution-and-projection-tp6772420p6772420.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list