[OpenLayers-Users] GWt + Openlayers - problem:GOOGLE layer appears in left corner

And. asufsc at gmail.com
Fri Feb 26 13:37:58 EST 2010



paweluz wrote:
> 
> Hi And!
> 
> Thanks for your help. I do not have any method updateSize() on my map...
> Below is my code...I hope you could help me... I removed the WMS layer
> from the code, because with or without it I still got the same problem... 
> 
> 
> 
> 
>     private void initializeGooglLayer(){
>         GoogleOptions googleLayeroptions= new  GoogleOptions();
>         googleLayeroptions.setIsBaseLayer(true);
>         googleLayeroptions.setSphericalMercator(true);
>         googleLayeroptions.setDisplayInLayerSwitcher(true);
>         googleLayeroptions.setDisplayOutsideMaxExtent(true);
>         GMapType gmapType = GMapType.G_NORMAL_MAP;
>         googleLayeroptions.setType(gmapType);
>         googleLayer = new Google("Goole Layer",googleLayeroptions);
>     }
> 
>   private void initializeMap(){
>         MapOptions mapOptions = new MapOptions();
>         mapOptions.setControls(new JObjectArray(new JSObject[] {}));
>         mapOptions.setNumZoomLevels(17);
>         mapOptions.setMaxResolution((float) 156543.0339);
>         Bounds myBounds = new Bounds(-20037508, -20037508,20037508,
> 20037508);
>         mapOptions.setMaxExtent(myBounds);
>         Projection myProjection = new Projection("EPSG:900913");
>         mapOptions.setProjection("EPSG:900913");
>         mapOptions.setDisplayProjection(myProjection);
>         mapWidget = new MapWidget("750px", "600px", mapOptions);
>         myMap = mapWidget.getMap();
> 
>         this.initializeGooglLayer(); // initialize Google layer
>  
>         myMap.addLayers(new Layer[] {googleLayer});
>         myMap.addControl(new PanZoomBar());
>         myMap.addControl(new MousePosition());
>         myMap.addControl(new LayerSwitcher());  
>         myMap.addControl(new Navigation());
>         LonLat center = new LonLat(1722814.18028, 6792060.56768);
>         myMap.setCenter(center, 14);
>     }  
> 
>     public void onModuleLoad() {
>         this.initializeMap();
>         openlayersPanel.add(mapWidget,DockPanel.CENTER);
>         addPanel.add(openlayersPanel);    
>         mainPanel.add(addPanel);
>         RootPanel.get("mainDiv").add(mainPanel);   
>   }
> 
> 
> 
> Regards,
> Poul
> 

Then create it.

	public static native void updateSize(JSObject map)/*-{
		map.updateSize();
	}-*/;

You just need pass as parameter to this method the object map.getJSObject();
.

-- 
View this message in context: http://n2.nabble.com/GWt-Openlayers-problem-GOOGLE-layer-appears-in-left-corner-tp4619582p4640966.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list