google maps - set the center as Europe at zoom level 1 -
i try set of coordinates display. done google maps api, somehow ends center of world. tried
map.setcenter( latlngbounds.getcenter(), map.fitbounds( latlngbounds ) );
and
var dor24 = new google.maps.latlng(52.519325,13.392709); map.setcenter( dor24); map.fitbounds( latlngbounds );
but somehow setting center ignored when @ zoom level 1. due inner workings of google maps or there way world map centered on europe , points showing?
these exmples talking about: http://hpsg.fu-berlin.de/~stefan/vortraege/
http://hpsg.fu-berlin.de/~stefan/vortraege/talk-map.html
edit: without fitbounds this:
don't call both map.setcenter
, map.fitbounds
, map.fitbounds
resets map center.
code snippet:
function initialize() { var map = new google.maps.map( document.getelementbyid("map_canvas"), { center: new google.maps.latlng(37.4419, -122.1419), zoom: 1, maptypeid: google.maps.maptypeid.roadmap }); var dor24 = new google.maps.latlng(52.519325, 13.392709); map.setcenter(dor24); } google.maps.event.adddomlistener(window, "load", initialize);
html, body, #map_canvas { height: 256px; width: 256px; margin: 0px; padding: 0px }
<script src="https://maps.googleapis.com/maps/api/js"></script> <div id="map_canvas"></div>
Comments
Post a Comment