javascript - Google maps setCenter using marker is not working properly as its is showing the market at left-top instead of center -


google maps setcenter using marker not working showing market @ left-top instead of center. following code have used :

<body id="viewmapscreen"> <div id="map" style="width: 600px; height: 349px;"></div>     <script type="text/javascript">      var address = 'pune, maharastra, india';     var map = new google.maps.map(document.getelementbyid('map'), {         maptypeid: google.maps.maptypeid.roadmap,        zoom: 8    });        var geocoder = new google.maps.geocoder();    geocoder.geocode({       'address': address    },    function(results, status) {       if(status == google.maps.geocoderstatus.ok) {          new google.maps.marker({             position: results[0].geometry.location,             map: map          });          map.setcenter(results[0].geometry.location);       }    });        </script>  </body> 

change width , height of div, works fine.

<div id="map" style="width: 1270px; height: 850px;"></div> 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -