SoFunction
Updated on 2025-03-10

Implement tag connections on Google Maps


<!DOCTYPE html>
<html>
<head>
<title>GeoLocation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
    html, body, #map-canvas {
        margin: 0;
        padding: 0;
        height: 100%;
    }
</style>
<script src="/maps/api/js?v=&sensor=false">>
<script>
    var map;
    var poly;
    function initialize() {
    var myLatlng = new (31.1937077, 121.4158436);
    var locations = [
    ['test1, accuracy: 150m', 31.1937077, 121.4158436, 100],
    ['test2, accuracy: 150m', 31.2937077, 121.4158436, 100],
    ['test3, accuracy: 150m', 31.0937077, 121.2158436, 100],
    ['test4, accuracy: 150m', 31.3937077, 120.4158436, 100],
    ['test5, accuracy: 150m', 31.1637077, 120.4858436, 100],
    ['test6, accuracy: 150m', 31.1037077, 121.5158436, 100]
    ];
    var mapOptions = {
    zoom: 13,
    center: myLatlng,
    mapTypeId:
    };
    map = new (('map-canvas'),
    mapOptions);
// Line settings
    var polyOptions = {
strokeColor: '#00ff00',     // Color
strokeOpacity: 1.0,    // Transparency
strokeWeight: 4    // Width
    }
    poly = new (polyOptions);
(map);    // Load
/* Loop to mark all coordinates */
    /*for(var i=0; i<; i++){
    var loc = [];
    (locations[i][1]);
    (locations[i][2]);
var path = ();    //Get the coordinates of the line
(new (loc[0], loc[1]));     //Add mark coordinates to lines
//Generate tag icon
    marker = new ({
        position: new (loc[0], loc[1]),
        map: map
        // icon: "/mapfiles/markers/marker_green.png"
    });
    }*/
    var marker, i, circle;
    var iwarray = [];
    var infoWindow;
    var latlngbounds = new ();
    var iconYellow = new ("/mapfiles/ms/icons/");
    for (i = 0; i < ; i++) {
        var loc = [];
        (locations[i][1]);
        (locations[i][2]);
var path = ();     //Get the coordinates of the line
        (new (loc[0], loc[1]));
        var latlng = new (locations[i][1], locations[i][2]);
        (latlng);
    if (locations[i][0].indexOf("[Cached") == 0 || (locations[i][0].indexOf("[Multiple") == 0 && locations[i][0].indexOf("[Cached") >= 0 )) {
            marker = new ({
                position: latlng,
                map: map,
                icon: iconYellow
            });
            var iw = '<div style="font-size: 12px;word-wrap:break-word;word-break:break-all;"><strong><font color="#FF0000">' + locations[i][0] + '<font></strong><div>';
        } else {
            marker = new ({
                position: latlng,
                map: map
            });
            var iw = '<div style="font-size: 12px;word-wrap:break-word;word-break:break-all;"><strong><font color="#000000">' + locations[i][0] + '<font></strong><div>';
        }
        iwarray[i] = iw;
        (marker, 'mouseover', (function(marker,i){
                return function(){
                    infoWindow = new ({
                        content: iwarray[i],
                        maxWidth: 200,
                        pixelOffset: new (0, 0)
                    });
                    (map, marker);
                }
            })(marker,i));
        (marker, 'mouseout', function() {
            ();
        });
        circle = new ({
            map: map,
            radius: locations[i][3],
            fillColor: '#0000AA',
            fillOpacity: 0.01,
            strokeWeight: 1,
            strokeColor: '#0000CC',
            strokeOpacity: 0.8
        });
        ('center', marker, 'position');
    }
    (latlngbounds);
    var listener = (map, "idle", function()
        {
        var zoomLevel = parseInt(());
        if (zoomLevel > 13)
            (13);
        });
    }
    (window, 'load', initialize);
</script>
</head>
<body>
    <div ></div>
</body>
</html>