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

paweluz paweluz at o2.pl
Mon Mar 1 02:53:18 EST 2010


Hi Ant!

Thanks a lot for your help... I have been looking on the Internet, and lot
of people have this same problem but no one gave any solution... I did as
you have told me, but this google layer is still in the left corner of the
map!! I add the updateMap function just before the center method... and
nothing... Can you please, please give any other clue??

My code:

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

    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());
        updateSize(myMap.getJSObject());
        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);  
  } 


Any idea??

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



More information about the Users mailing list