Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 多个谷歌标记在同一个地方_Google Maps_Google Maps Markers - Fatal编程技术网

Google maps 多个谷歌标记在同一个地方

Google maps 多个谷歌标记在同一个地方,google-maps,google-maps-markers,Google Maps,Google Maps Markers,我正在尝试使用带有标记的谷歌地图。我在地图上放置标记没有任何问题,但是当我必须在同一个地方放置标记时,如何才能像谷歌地球一样分割标记?像这样: 谢谢 我不明白你想要实现什么,但是 您是否已经检查了标记聚类算法,如或?您好,谢谢您的回答,是的,我已经检查了其他标记,但这不是我所说的,当标记处于完全相同的位置时,我如何查看标记?在谷歌地球上有这样做的选择吗? //Here is my attempt... a Archimedes spiraling out of the markers: //

我正在尝试使用带有标记的谷歌地图。我在地图上放置标记没有任何问题,但是当我必须在同一个地方放置标记时,如何才能像谷歌地球一样分割标记?像这样:


谢谢

我不明白你想要实现什么,但是


您是否已经检查了标记聚类算法,如或?

您好,谢谢您的回答,是的,我已经检查了其他标记,但这不是我所说的,当标记处于完全相同的位置时,我如何查看标记?在谷歌地球上有这样做的选择吗?
//Here is my attempt... a Archimedes spiraling out of the markers:

// calc a spiraling out position based on marker count at that location
// this function is very tweeky
function spiral_coords(lat_long, i) {
    i = (i == 1)? 0: i+1;
    var r = i * 0.002;
    // .8 is a fudge number to adjust to real appearance on the map
    return [lat_long[0] + (r * .8 * Math.sin(.5 * (i + 2))), lat_long[1] + (r * Math.cos(.5 * (i + 2)))];
}

// this is from a fusion table query... but your source could be anything
// I take the coords and check against a hash count of them and calc out the spiral position
function data_handler(d) {
    var map = $("#map")[0];
    map.markers = [];

    var rows = d.rows;
    var fields = d.columns;
    var index = {};
    for (var i in fields) {
        index[fields[i]] = i;
    }
    var location_count = {};

    for (var i in rows) {
        var row = rows[i];
        var location = row[index["Location"]];
        var lat_long = location.split(" ");
        lat_long[0] = parseFloat(lat_long[0]);
        lat_long[1] = parseFloat(lat_long[1]);
                // here are the active ingredients
        if(!(location in location_count)) {
            location_count[location] = 0;
        }
        location_count[location]++;
        lat_long = spiral_coords(lat_long, location_count[location]);
        var marker = new google.maps.Marker({
            position: new google.maps.LatLng(lat_long[0], lat_long[1]),
            map: map.map
        });
    }
}