Google base maps misbehaving, blank tiles, not centered
I have an app that embeds two OL maps in different jQuery tabs on the same ASPX page. I'm using OL v2.11. When I use OpenLayers.Layer.Bing base layers (getting tiles direct, no Bing API) the maps render fine: it properly zooms to the predefined initial extent at the correct scale and renders all tiles. But when I use OpenLayers.Layer.Google base layers (using API at http://maps.google.com/maps/api/js?v=3.5) then things don't work so well: the first map renders with blank tiles and out-of-center (see image below) until I actually drag on it, which snaps it back into place.
The second map is a map of search results, so it overlays markers on top of GMaps base layers, but this map never renders properly: only the tile in the upper-left corner ever renders, and the rest of the map remains gray tiles (see image below).
The app uses the exact same class for the map that another app is using, and that application does not have the same problem even when using GoogleMaps. But the other app has a single map on the ASPX page and does not have nearly the same jQuery UI stuff going on.
Re: Google base maps misbehaving, blank tiles, not centered
The function repositionMapElements() (I used map.layers.repositionMapElements()) came to the rescue -- it was all I needed. It's a workaround and would be nice not to have to use it, but it works for now...
NOT RESOLVED: Google base maps misbehaving, blank tiles, not centered
So there were two issues:
1. not all tiles loading properly, gray tiles getting loaded instead
2. the map not centered on the defined center point
Using repositionMapElements() fixed problem #1, but not #2.
What's happening with #2 is peculiar: the map has the mouse position control so I can see from my mouse position that it is centered on the LonLat to which I did a setCenter(). But the tiles are offset so that they're actually displaying about 1 tile south and 1 tile east as the center point. What's more, if I click and drag to pan the map ever so slightly, it snaps into the correct position. Also, toggling the base map layer to a different layer also "snaps" the map back to the correct center point.