Opened 8 years ago

Last modified 6 years ago

#283 reopened defect

layerstore treepanel loader plus groupPanel dont play nice with Google maps.

Reported by: pscadden Owned by:
Priority: major Milestone: 1.2
Component: GeoExt Version: trunk
Keywords: google map treeloader Cc:
State: Needs more work


If a map is created but not rendered, and then google layers added a treepanel, then the google map does not display, and if layer is switched (whether by treepanel or layerswitcher), it does not display the correct size or bounds. Identical code without treepanel work okay.

Attach are two test html files. The first doesnt work. The second (without treepanel), does.

Attachments (3)

test.html (7.4 KB) - added by pscadden 8 years ago.
Code showing failure
test4.html (6.2 KB) - added by pscadden 8 years ago.
Same code, no treepanel
geoext-283.patch (698 bytes) - added by ahocevar 7 years ago.

Download all attachments as: .zip

Change History (15)

Changed 8 years ago by pscadden

Code showing failure

Changed 8 years ago by pscadden

Same code, no treepanel

comment:1 Changed 7 years ago by pscadden

Attached is very minimal code from Thomas Baginski.

<!DOCTYPE html

PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN"


<html xmlns="" xml:lang="en" lang="en">


<meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>Google/Map Panel Bug test</title> <script type="text/javascript" src="ext-3.1.1/adapter/ext/ext-base-debug.js"></script> <script type="text/javascript" src="ext-3.1.1/ext-all-debug.js"></script> <script type="text/javascript" src="OpenLayers-2.9/lib/OpenLayers.js"></script> <script type="text/javascript" src="GeoExt0.7/script/GeoExt.js"></script> <script type="text/javascript" language="javascript" src=";v=2&amp;key=ABQIAAAAR7YD2FMuJnK6_0QbbbF44hS3s4pSqQ84owDwZe7riLV-_wB94xRGhe29tjh7Jrc8S8JJWUWq19mq-A"></script> <link rel="stylesheet" href="ext-3.1.1/resources/css/ext-all.css" type="text/css" />

</head> <body style="margin:5; padding:0; height:100%; width:100%; border:none;"> <script type="text/javascript"><!--


var map = new OpenLayers.Map(); map.addLayers([new OpenLayers.Layer.Google(

"Google Physical", {type: G_PHYSICAL_MAP, visibility: true}

), new OpenLayers.Layer.Google(

"Google Streets", {numZoomLevels: 20}


var myLayerStore = new{

map: map

}); var mapViewer = new Ext.Panel({

renderTo: 'mapviewerid', layout: 'border', width: 800, height: 600, collapsible: false, items:[{

xtype: 'treepanel', id: 'westid', title: 'West', region: 'west', width: 200, collapsible: true, collapsed: true, root: new GeoExt.tree.LayerContainer({

text: 'All Layers', layerStore: myLayerStore, leaf: false, expanded: true


}, {

xtype: 'gx_mappanel', region: 'center', layout: 'fit', map: map, layers: myLayerStore, center: [-122, 38], zoom: 5

} ]

}); Kludge to make google and GeoExt.tree.LayerContainer play nice together start with the treepanel collapsed then these three steps in order make it work. The combination of switching layers and causing the mappanel to resize gets the google layer to fill the mappanel

map.layers[1].setVisibility(true); Ext.getCmp('westid').expand(false); map.layers[0].setVisibility(true); });

--> </script> <div id='mapviewerid' style="width: 900px; height: 500px;"></div>

</body> </html>

Changed 7 years ago by ahocevar

comment:2 Changed 7 years ago by ahocevar

  • State changed from None to Review

attachment:geoext-283.patch fixes the issue. enforceOneVisibile should not be used for the internal baselayer group. All tests still pass, and the example pasted above works with the patch applied. Thanks for any review.

comment:3 Changed 7 years ago by tschaub

  • Priority changed from blocker to major
  • State changed from Review to Commit

Looks good. Please commit.

comment:4 Changed 7 years ago by ahocevar

  • Resolution set to fixed
  • Status changed from new to closed

(In [2222]) do not enforceOneVisible for "real" base layers. r=tschaub (closes #283)

comment:5 Changed 7 years ago by ahocevar

  • Type changed from enhancement to defect

comment:6 Changed 7 years ago by pscadden

  • Resolution fixed deleted
  • Status changed from closed to reopened

A zombie! If you remove all google layers from map and then add different ones, the problem resurfaces.

comment:7 Changed 7 years ago by fredj

  • State changed from Commit to Needs more work

comment:8 Changed 7 years ago by ahocevar

  • Milestone changed from 1.0 to 1.1

No tests, no patch. Bumping.

comment:9 Changed 7 years ago by pscadden

Possibly more insight as I tried to follow through this basic behavior in another context. Setting the map to a non-google projection, then removing the layers and replacing with google layer gives same issue as shown here - the map rendering is not honouring the center and extent values in the map object. The google mapobject center value somewhere gets different values. IT DOESNT get these new values from a call to mapObject.setCenter (all calls to this get the correct coordinates in the mapobject). Somewhere else in the render, the mapObject center gets changed but I cannot trap where. If you delete the layers and replace with identical set of google layers and set the same mapextent, then it comes right again. Frustrating beyond belief.

comment:10 Changed 7 years ago by ahocevar

@pscadden: can you please provide a really minimal example that shows the issue? When we cannot reproduce the issue, we cannot fix it.

comment:11 Changed 7 years ago by ahocevar

By "example" I mean html+javscript that we can run off the examples folder, like our other examples.

comment:12 Changed 6 years ago by ahocevar

  • Milestone changed from 1.1 to 1.2

Batch move of tickets to finish the 1.1 milestone.

Note: See TracTickets for help on using tickets.