角上的谷歌地图群集选项的任何文档?选项、文档、地图

2023-09-14 00:26:43 作者:泪烬染不相见

我使用可用的角谷歌地图图书馆这里 https://github.com/nlaplante /角谷歌 - 地图。它似乎pretty强大,但它缺乏详尽的文档......我想我的簇标记,但我不能找到如何做到这一点的工作示例。没有人能做到呢?

Hi I am using the Angular Google Maps library available here https://github.com/nlaplante/angular-google-maps. it seems pretty powerful but it lacks exhaustive documentation... I am trying to cluster my markers but I can't find a working example of how to do it. Did anyone manage to do it ?

推荐答案

现在的问题是有点老了,但也许这可以与人相同的问题是有用的。

The question is a bit old, but maybe this can be useful for someone with the same issue.

下面是从code我用一个简单的例子:

Here is a simple example from the code I used:

在我的控制器,我生成一个标记阵列此结构:

On my controller, I generate a markers array with this structure:

 var markers = new Array();

    for(var i = 0; i < someData.length; i++ ){

        var newMarker = {
            id: parseInt(i),
            latitude: parseFloat(someData[i].latitude),
            longitude: parseFloat(someData[i].longitude),
            showWindow: false,
            title: "Marker"+i,
        }

        newMarker.onClicked = function () {
            alert(newMarker.id);
        }

        markers.push(newMarker);
    }

    $scope.markers = markers;

然后在视图:

<google-map center="map.center" draggable="true" options=map.options zoom="map.zoom">

        <markers models="markers" coords="'self'" doCluster=true click="'onClicked'">
        </markers>

    </google-map>