[OpenLayers-Users] OL Map setcenter problem with IE

Christopher Schmidt crschmidt at metacarta.com
Fri Mar 6 08:09:47 EST 2009


On Fri, Mar 06, 2009 at 11:17:32AM +0100, Emmanuele Sordini wrote:
> Dear All
> I am a new ML member and a recent OL user.
> 
> Presently I'm faced with a very nasty problem that only happens with
> Internet Explorer (Firefox works ok). I'm using OL Map to render a map
> which uses Google Streets; I'm using the latest stable release (2.7).
> 
> My init() function ends as follows:
> 
>         var mapCenter = new OpenLayers.LonLat(0, 0);
>         map.setCenter(mapCenter, 1);
> 
> which would mean to fit the whole planisphere in the map. But when it
> is rendered, only the upper left quadrant is visible, whereas the rest
> is completely blank, as if the map (0,0) lon/lat point were associated
> with the div's top left corner instead of its center. Curiously
> enough, if I slightly "nudge" the map with the mouse, it "flickers" or
> "jumps" for a moment and gets rendered correctly.
> 
> Any help on this issue, which as been haunting me for a few days now,
> would be greatly appreciated.

Sounds like you may be initializing the map before IE has completely
drawn the div, and Google therefore gets a size of 0 initialized at some
point. At the end of your function, try a map.updateSize() to kick the
map; it may help.

REgards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list