If you do not want repetitions, you need to control the minimum scaling, and the width of your map will be less than or equal to one width of the base fragments with the minimum zoom level allowed on your map. When scaling zero, one width of the world represents a single 256 x 256-pixel slab, each level of increase increases, which is 2 times.
This will display one map width at zoom level 1 (512x512 map), you can change the height, but the width should be 256 at 0, 512 at 1, 1024 at 2, etc.
<!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map-canvas { height: 512px; width:512px;} </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false"> </script> <script type="text/javascript"> function initialize() { var mapOptions = { center: new google.maps.LatLng(-34.397, 150.644), zoom: 1, minZoom: 1 }; var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"/> </body> </html>
code snippet:
function initialize() { var mapOptions = { center: new google.maps.LatLng(-34.397, 150.644), zoom: 1, minZoom: 1 }; var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); } google.maps.event.addDomListener(window, 'load', initialize);
html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map-canvas { height: 512px; width: 512px; }
<script src="https://maps.googleapis.com/maps/api/js"></script> <div id="map-canvas"></div>
source share