[OpenLayers-Users] NOT RESOLVED: Google base maps misbehaving, blank tiles, not centered

crb chris at windsorsolutions.com
Tue May 15 19:54:04 PDT 2012


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.

I tried doing this programmatically by doing:

        map.panTo(new OpenLayers.LonLat(map.getCenter().lon + 1,
map.getCenter().lat + 1));
        map.panTo(new OpenLayers.LonLat(map.getCenter().lon - 1,
map.getCenter().lat - 1));

and 

        map.setBaseLayer(map.layers[1]);
        map.setBaseLayer(map.layers[0]);

upon initializing the map, but neither work. Though I'm not thrilled about
using that as a solution anyway.

Thoughts?  Ideas?

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Google-base-maps-misbehaving-blank-tiles-not-centered-tp4974823p4974897.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list