Google Maps API InvalidValueError:不是LatLngBounds或LatLngBoundsLiteral:不是对象

时间:2017-04-30 19:32:49

标签: html geolocation

我真的很喜欢这个HTML ....团队acan任何身体看看?我得到了一个InvalidValueError:不是LatLngBounds或LatLngBoundsLiteral:不是对象。

Page是使用geocell github中的Python编写的,但项目似乎已经死了

<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
        <meta charset="utf-8">
        <title>Circles</title>
        <style>
            html, body {
                height: 100%;
                margin: 0;
                padding: 0;
            }
            #map {
                height: 100%;
            }
    </style>
    </head>
    <body>
        <div id="map"></div>
        <script>

        var cells = [{rssi: -82, ulocation: {ulat: 40.701930999999995, ulng: 29.8919394}, uaccuracy: 3184.0}, {rssi: -85, ulocation: {ulat: 40.7016324, ulng: 29.8815625}, uaccuracy: 1875.0}, {rssi: -93, ulocation: {ulat: 40.7641777, ulng: 29.8014425}, uaccuracy: 3092.0}, {rssi: -94, ulocation: {ulat: 40.7053316, ulng: 29.8577584}, uaccuracy: 2297.0}, {rssi: -97, ulocation: {ulat: 40.706842699999996, ulng: 29.888572699999997}, uaccuracy: 1861.0}, {rssi: -98, ulocation: {ulat: 40.702627799999995, ulng: 29.819846899999998}, uaccuracy: 2484.0}, {rssi: -99, ulocation: {ulat: 40.7055942, ulng: 29.886253999999994}, uaccuracy: 2678.0}]

        function initMap() {
            var map = new google.maps.Map(document.getElementById('map'), {
                mapTypeControl: true,
                mapTypeControlOptions: {
                    mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain']
                },
                mapTypeId: 'hybrid'
            });

            marker = new google.maps.Marker({
                position: {lat: 40.70363788207133, lng: 29.883347748082866},
                map: map
            })

            var opmul = 0.25/cells.length
            for (var i in cells) {
                var cell_circle =  new google.maps.Circle({
                    strokeColor: i == 0 ? 'yellow' : 'red',
                    strokeOpacity: 0.8,
                    strokeWeight: 2,
                    fillColor: i == 0 ? 'lime' : 'red',
                    fillOpacity: (cells.length - i) * opmul,
                    map: map,
                    center: cells[i].location,
                    radius: cells[i].accuracy
                })
                if (i == 0) {
                    map.fitBounds(cell_circle.getBounds())
                }
            }
        var flightcords = [
                    {lat: 37.772, lng: -122.214},
                          {lat: 21.291, lng: -157.821},
                          {lat: -18.142, lng: 178.431},
                          {lat: -27.467, lng: 153.027},
                    ];


        var flightpath = new google.maps.Polyline({
            path: flightcords,
            geodesic: true,
            strokeColor: 'blue',
            strokeOpacity: 0.4,
            strokeWeight: 4
        });

        flightpath.setMap(map);

    }
    </script>
    <script async defer
        src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxxxx&callback=initMap">
    </script>
</body>

0 个答案:

没有答案