如何从Google Maps API v3删除国际日期变更线(IDL)和赤道? [英] How to remove the international date line (IDL) and equator from Google Maps API v3?

查看:69
本文介绍了如何从Google Maps API v3删除国际日期变更线(IDL)和赤道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照标题,我想从地图上删除IDL和赤道线.我正在使用以下代码:

As per the title, I would like to remove the IDL and equator line from my map. I am using the following code:

<script src="https://maps.googleapis.com/maps/api/js?key=KEY&sensor=false"></script>
<script>
var locations = [
['<p>Location 1<br/> <a href="http://example.com/location1">Click here for more info</a></p>', 64.8436, -147.7231, 1],
['<p>Location 2<br/> <a href="http://example.com/location2">Click here for more info</a></p>', 33.4500, -112.0667, 2],
['<p>Location 3<br/> <a href="http://example.com/location3">Click here for more info</a></p>', 34.0500, -118.2500, 3],
['<p>Location 4<br/> <a href="http://example.com/location4">Click here for more info</a></p>', 32.7150, -117.1625, 4],
];

var map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: new google.maps.LatLng(19.4328, -99.1333),
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
overviewMapControl: false
});

var infowindow = new google.maps.InfoWindow();

var marker, i;

for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
    position: new google.maps.LatLng(locations[i][1], locations[i][2]),
    map: map
});

google.maps.event.addListener(marker, 'click', (function(marker, i) {
    return function() {
        infowindow.setContent(locations[i][0]);
        infowindow.open(map, marker);
    }
})(marker, i));
}

</script>

我对此很陌生,任何帮助将不胜感激.

I'm quite new to this, and any assistance would be much appreciated.

推荐答案

根据

According to this post, you need to set some undocumented properties on a stylized map. This may remove other features beyond the IDL and equator.

 var map = new google.maps.Map(document.getElementById('map'), {
 zoom: 2,
 center: new google.maps.LatLng(19.4328, -99.1333),
 mapTypeControl: false,
 scaleControl: false,
 streetViewControl: false,
 overviewMapControl: false
 });

 var mapStyle = [
      {
         featureType: "administrative",
         elementType: "geometry.fill",
         stylers: [
            { visibility: "off" }
         ]
       }
  ];
 var styledMap = new google.maps.StyledMapType(mapStyle);
 map.mapTypes.set('myCustomMap', styledMap);
 map.setMapTypeId('myCustomMap');

请参见 http://jsfiddle.net/stevejansen/pBh6p/

这篇关于如何从Google Maps API v3删除国际日期变更线(IDL)和赤道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆