避免重复谷歌地图v3中同一国家/地区的标记

时间:2014-01-09 11:04:59

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

您好我正在使用谷歌地图v3。为测试目的我只是通过粘贴以下代码加载谷歌地图

在html页面中。地图成功加载。但是如何在地图上加载初始标记,我的标记不应该重复,因为我将使用信息窗口。就像一个国家说北美如果当我在地图上向右/向左滚动以获得另一个北美实例时,我的标记应该转移到这个新标记并且之前的标记应该被删除。我希望我不是很困惑。我非常新的这个领域。请指导。谢谢

我试过这样的http://gmaps-utility-library-dev.googlecode.com/svn/trunk/markermanager/examples/google_northamerica_offices.html(please缩小到0级,然后观察标记,我只需要这样的东西)

使用标记管理器来实现上述目的但这对我来说并不是因为标记本身没有被加载

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
    <title>JS Bin</title>
    <!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
html, body{
    margin:0;
    height: 100%;  
    padding: 0;
}
#map {
height: 100%;
}
</style>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script type="text/javascript" src="../../Scripts/MarkerManager.js"></script>
<script>
    var map;
    function initialize() {

        var mapOptions = {
            center: new google.maps.LatLng(0, 0), zoom: 2,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        map = new google.maps.Map(document.getElementById("map"), mapOptions);
        // map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
        // var mgr = new MarkerManager(map, mapOptions);
    }
        google.maps.event.addDomListener(window, 'load', initialize);


</script>
</head>
<body>
     <div id="map"></div>
</body>
</html>

0 个答案:

没有答案