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
Javascript heatmap.js在锅后变得神经质_Javascript_Google Maps_Heatmap - Fatal编程技术网

Javascript heatmap.js在锅后变得神经质

Javascript heatmap.js在锅后变得神经质,javascript,google-maps,heatmap,Javascript,Google Maps,Heatmap,我正在使用heatmap.js+googlemap 热图显示完美,我可以放大和缩小没有问题。 但一旦我拖动了贴图,渲染就会变得不稳定。 也就是说,刷新时,它会与拖动同步显示,但会立即将热图转换到拖动前的位置。每次刷新时它都会像这样神经质 代码如下: this.options = { zoom: 5, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP,

我正在使用heatmap.js+googlemap

热图显示完美,我可以放大和缩小没有问题。 但一旦我拖动了贴图,渲染就会变得不稳定。 也就是说,刷新时,它会与拖动同步显示,但会立即将热图转换到拖动前的位置。每次刷新时它都会像这样神经质

代码如下:

this.options = {
          zoom: 5,
          center: myLatlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          disableDefaultUI: false,
          scrollwheel: true,
          draggable: true,
          navigationControl: true,
          mapTypeControl: false,
          scaleControl: true,
          disableDoubleClickZoom: false
        };
        this.map = new google.maps.Map(this.$el, this.options);

        this.heatmap = new HeatmapOverlay(this.map, {
            "radius":20,
            "visible":true, 
            "opacity":60
        });


        // this is important, because if you set the data set too early, the latlng/pixel projection doesn't work
        var that = this;
        google.maps.event.addListenerOnce(this.map, "idle", function(){
            that.updateMap(that.map);
        });
        google.maps.event.addListener(this.map, 'bounds_changed', function(e) {
            that.updateMap(that.map);
    });

有什么想法吗

干杯

updateMap: function (map, callback){
        var bound = map.getBounds();
        var queryObject = {
                north: bound.getNorthEast().lat(),
                south: bound.getSouthWest().lat(),
                east : bound.getNorthEast().lng(),
                west : bound.getSouthWest().lng(),
        };
        $.getJSON('areaGeolocations', queryObject, function(data) {
            var geoData = new Array();

            $.each(data.geolocationLogs, function(key, val) {
                geoData.push({lng:val.longitude, lat:val.latitude, count:1});
            });

            that.heatmap.setDataSet({max: 5, data: geoData});
            if(callback)
                callback();
        });
    },