jaybee18

Using globoserve ClusterLayer

Discussion created by jaybee18 on Mar 18, 2011
Latest reply on Mar 18, 2011 by jaybee18
I want to use the ClusterLayer with a map which doesn't use any of the supported coordinate systems. So I create a bunch of points in the coord system of the map (wkid 27700), then create a set of graphics based on the points but converting the geometry to mercator -- the graphics geometry has wkid 102100, which is one of the supported ones. Trouble is, nothing is showing up on my map. Any ideas what I'm doing wrong?

$.getJSON('includes/ajax-allrecords.cfm', d, function(data) {
  //convert records to points and check whether they are contained in the selected feature
  var points = [];
  var point, val;
  var sym = new esri.symbol.SimpleMarkerSymbol();
  for(var i=0, dl=data.length;i<dl;i++) {
      val = data[i];
      var p = new esri.geometry.Point(val.x, val.y, map.spatialReference);
      for(var j=0; j < selectedPolys.length; j++) {
   if (selectedPolys[j].contains(p)) {
       points.push(new esri.Graphic(esri.geometry.geographicToWebMercator(p), sym, val, new esri.InfoTemplate('${x}', '${x} ${y}')));
       break;
   }
      }
  }
  if(points.length > 0) {
      var cL = new esri.ux.layers.ClusterLayer({
   displayOnPan: false,
   map: map,
   features: points,
   infoWindow: {template: new esri.InfoTemplate('${x}', '${y}'),
         height: 225,
         width: 85},
   flareLimit: 15,
   flareDistanceFromCenter: 20 
         });
      map.addLayer(cL);
      //set new event handler
      dojo.connect(map, "onClick", afterZoomOnClick);
      retrievedAreaRecords = true;
  } else {
      $('#sightingsLink').html(sorry);
  }
  Utils.hideLoadingSimple();
     });

Outcomes