Using globoserve ClusterLayer

402
1
03-18-2011 06:53 AM
JamesBurton
New Contributor
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;
      var p = new esri.geometry.Point(val.x, val.y, map.spatialReference);
      for(var j=0; j < selectedPolys.length; j++) {
   if (selectedPolys.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();
     });
0 Kudos
1 Reply
JamesBurton
New Contributor
FWIW I've also tried editing the ClusterLayer file to accept the wkid I'm using and supplying the features with the orginal coordinate system, and still the layer isn't showing me anything.
0 Kudos