小编San*_*ndy的帖子

Google Maps V3带有中心多个标记和自动缩放的问题

我需要知道如何将所有标记居中并自动缩放地图以使其适合我在以下地图中的所有内容.我几天就打破了头来解决问题,请帮助我.

我的代码

<script type="text/javascript">  
  var map;
  var address = new Array();
  //we can also create following array with a for loop
  address[0] = '798 9th Ave, New York, NY';
  address[1] = '42 E 29th St, New York, NY';
  address[2] = '56 W 25th St, New York, NY';
  address[3] = '26 W 21th St, New York, NY';

  function initialize() {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {zoom: 15, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP}
    map = …
Run Code Online (Sandbox Code Playgroud)

google-maps center zoom google-maps-markers

2
推荐指数
1
解决办法
8035
查看次数

标签 统计

center ×1

google-maps ×1

google-maps-markers ×1

zoom ×1