2015-04-02 205 views

回答

0

见的Google Maps Javascript API v3 Overview

的文档,默认情况下打开,添加到您的MapOptions:

overviewMapControl: true, 
    overviewMapControlOptions: {opened: true} 

proof of concept fiddle

代码片段:

function initialize() { 
 
    var map; 
 
    var myOptions = { 
 
    zoom: 14, 
 
    center: new google.maps.LatLng(53.382971, -1.4702737), 
 
    mapTypeId: 'roadmap', 
 
    overviewMapControl: true, 
 
    overviewMapControlOptions: { 
 
     opened: true 
 
    } 
 
    }; 
 
    map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); 
 
} 
 
google.maps.event.addDomListener(window, "load", initialize);
html, 
 
body, 
 
#map_canvas { 
 
    height: 100%; 
 
    width: 100%; 
 
    margin: 0px; 
 
    padding: 0px 
 
}
<script src="https://maps.googleapis.com/maps/api/js"></script> 
 
<div id="map_canvas" style="border: 2px solid #3872ac;"></div>

+0

感谢geocodezip可以请你也让我知道如何设置总览图的大小? – Suffii 2015-04-02 19:55:14

+0

您无法修改内置控件的大小(至少据我可以从文档中知道)。如果要定制总览图控件,请查看[extoverviewcontrol](http://google-maps-utility-library-v3.googlecode.com/svn/trunk/extoverviewmapcontrol/docs/reference.html)第三方库。 – geocodezip 2015-04-02 20:24:50