基于所有标记的 ngMap 缩放

ngMap Zoom based on the all the markers

我有一个场景,我必须在地图上显示所有标记。我使用 angular-map 可以看到所有标记,但缩放级别无法控制。我无法限制显示三个地图副本的缩放级别。我创建了一个 plunker.

如何显示所有可见的标记。谁能帮我解决这个问题。

<map zoom-to-include-markers="auto" center="[{{ center.lat }}, {{ center.lng }}]">
    <marker position="[{{ center.lat }}, {{  center.lng }}]"></marker>
    <marker ng-repeat="result in results track by $index" position="[{{ result.lat }}, {{ result.lng }}]"></marker>
</map>

$scope.results = [
    {"lat":17.51081384,"lng":78.35414886},
    {"lat":17.49018563,"lng":78.39860916},
    {"lat":38.50795202,"lng":-121.503544},
    {"lat":38.50795044,"lng":-121.50354534},
    {"lat":38.50794677,"lng":-121.50354065},
    {"lat":40.75376321,"lng":-73.9868018},
    {"lat":68.39918004,"lng":101.6015625},
    {"lat":17.4140375,"lng":78.40826511},
    {"lat":17.5124509,"lng":78.37766647},
    {"lat":17.36538432,"lng":78.55173111},
    {"lat":17.40805893,"lng":78.4905982},
    {"lat":17.51048643,"lng":78.35294724},
    {"lat":17.51277831,"lng":78.35483551},
    {"lat":17.41845987,"lng":78.49113464},
    {"lat":82.58610635,"lng":-31.9921875},
    {"lat":-20.30341752,"lng":-56.77734375},
    {"lat":27.05912578,"lng":2.28515625}
];

您无法避免 google 地图重复 -> 对此没有解决方案,因为它是 google 地图的一个特征。

这取决于地图分辨率。这是一张 plunker 的小地图,其中包含不同的格式。重复是 Google 地图功能。您可以尝试强制设置地图的格式,以免重复出现。请记住,用户始终可以通过向东或向西滚动来查看重复的地图。

<div style="width:250px;height:100px">
  <map zoom-to-include-markers="auto" center="[{{ center.lat }}, {{ center.lng }}]">
    <marker position="[{{ center.lat }}, {{  center.lng }}]"></marker>
    <marker ng-repeat="result in results track by $index" position="[{{ result.lat }}, {{ result.lng }}]"></marker>
  </map>
</div>