1

Closed

V7ClientSideCustering.js SetData fails on single element

description

/**
    * Sets the data that is to be clustered and displayed on the map. All objects 
    * must at minimium have a Latitude and Longitude properties. 
    * The algorithm will convert them to a Location object when loading in data.
    * @param {[object]} data - An array of objects that are to be mapped. 
    */
    this.SetData = function (data) {
        if (data != null) {
            _data = data;

            var i = _data.length - 1;

            if (i > 0) {  // <======== This should be if (i >= 0)
                do {
                    //convert the data coordinate into a Location object and store it.
                    _data[i]._LatLong = new Microsoft.Maps.Location(_data[i].Latitude, _data[i].Longitude);
                } while (i--)
            }
        } else {
            _data = [];
        }

        cluster();
    };
Update: Source: http://www.bingmapsportal.com/Scripts/V7ClientSideClustering.js
Closed Apr 27, 2015 at 9:13 PM by rbrundritt

comments