AndyMan

Cluster Layer from data and the single Popup?

Discussion created by AndyMan on Oct 9, 2013
Latest reply on Oct 24, 2013 by AndyMan
Hey there..
I am working with the esri ClusterLayer.js and have gotten to the point here I can feed it a large JSON and then have it render successfully on my webmap.  I have been reading many of the different threads (a really good one: http://forums.arcgis.com/threads/68422-ESRI-point-clustering-example-using-featurelayer-or-querytask-as-input)  and they are all of a help but I am confused about how to render the individual infoWindow or popup for the singles.  The best I have been able to get is the "clusterID" and then the value to show in the "singletemplate"..



I am calling it thusly..
Using the code from the examples..


 var aDocs= [{
   "place": "a happy place",
   "label": "a happy label",
   "coords": "33.540744, -117.782432�?�
 },{
   "place": "another nearby happy place",
   "label": "a happy label",
   "coords": "33.540744, -117.782432" 
 }];

 function addClusters(aDocs){
   try{
      for (var key in aDocs){
         console.log(aDocs [key];
         var myObj = aDocs [key];
         var coordPair = [];
         for(var prop in myObj){
            if (myObj.hasOwnProperty(prop)){
              if(prop === �??coords�??){
                   coordPair = myObj[prop].split(�??,�??);
                   myObj[�??y�?�] = parseFloat(coordPair[0]);
                   myObj[�??x�?�] = parseFloat(coordPair[1]);
              }
            }
         }       
       }
     clusterLayer = new extras.ClusterLayer({


       �??data�?�: aDocs,
        �??distance�?�: 100,
        �??id�?�:�?�clusters�?�,
        �??labelColor�?�: �??#fff�?�,
        �??labelOffset�?�: 10,
         �??resolution�?�: map.extent.getWidth() / map.width,
        �??singleColor�?�: �??#888�?�,
        �??singleTemplate�?�: infoTemplate
     });
   }
   catch(e){
     console.log(e);
   }
 }
 


Does anyone know how to get setup the template?


I've been able to put over 2,000 points on the map and everything looks nice but the infoTemplate is eluding me..

Andy...

Outcomes