Google Maps widget with a lot (>1500) markers

0
I want to display a large amount of markers on a map. In total it would be +/- 6000. When I load the Google Maps widget to shown them I recieve a generic error (contact your system admin) and see the following in the javascript console --> Maximum call stack size exceeded I figured out that the maximun amount of objects I can load in the map is 1500 objects. I also found something about clustering the markers at https://developers.google.com/maps/documentation/javascript/marker-clustering , which would probably be a nice option for us. Is it possible to ignore the maximum ammount of markers or is it possible to implement the clustering on the maps widget? Any advise on how to handle this would be appreciated. 
asked
1 answers
1

The implementation of the widget is done with a recursive function for a couple of reasons, mainly to make it synchronous instead of asynchronous, but this has a drawback.

 

You can start by making remove the function from the loop, because javascript will declare 6000 functions

                dojoArray.forEach(this._latlngObjs, lang.hitch(this, function (obj) {
                    this._addMarker(obj);

                    var position = this._getLatLng(obj);
                    if (position) {
                        bounds.extend(position);
                        validCount++;
                        panPosition = position;
                    } else {
                        logger.error(this.id + ": " + "Incorrect coordinates (" + this.checkAttrForDecimal(obj, this.latAttr) +
                                      "," + this.checkAttrForDecimal(obj, this.lngAttr) + ")");
                    }
                }));

the recursive function will remove the last from the list and call itself again. This cost a lot of space.

answered