如何在Google地图上添加概述地图

时间:2015-04-02 19:19:04

标签: google-maps google-maps-api-3

有人可以告诉我是否可以在谷歌地图上有一个概述地图? ArcGIS API在this link提供此小部件,所以我想知道如果我们可以在Google Map上执行相同操作>

由于

1 个答案:

答案 0 :(得分: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>