Google Maps setCenter() problem

Posted by hotcoder on Stack Overflow See other posts from Stack Overflow or by hotcoder
Published on 2010-05-05T12:47:24Z Indexed on 2010/05/05 12:58 UTC
Read the original article Hit count: 215

Filed under:
|

I'm using google maps. In my code i've used setCenter() function. My problem is that marker is always located on top left corner of map area (not at the center). Please tell me how to resolve it?

My piece of code is

 lat = 46.437857;
        lon = -113.466797;

            marker = new GMarker(new GLatLng(lat, lon));


            var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(20, 40));
            map.addControl(new GLargeMapControl3D(), topRight);
            map.setCenter(new GLatLng(lat, lon), 5);

            map.addOverlay(marker);

© Stack Overflow or respective owner

Related posts about google

Related posts about google-maps