Solved! Go to Solution.
It's hard to know why you're getting that error w/o seeing the entire context. The post you replied to is 2 years old and was in legacy (nonAMD) code. Maybe you're getting stuck there. There was both a legacy and AMD version of clusterLayers are one point, right when AMD first came out. Generally when I have the sort of error you're describing, it's nothing to do with the function, it's because I don't have something right toward the top, either in my dojoConfig definition or when I'm setting all my requires.
hi again
not sure i understand what you mean by AMD.
is ther a new version ?
It sounds like you need to do some more reading on the differences between AMD and legacy style code. AMD is not new. Throughout the samples and help pages, you'll see syntax that might say either 'legacy code' or AMD. It has to do with how the modules are first loaded, among other things.
Here's another thread that discusses the differences. It's hard to know specifically what your problem is from the small amount of code you've provided.
sorry , i forgot that the A in AMD stands for Asynchronous
i am aware of that , and also am using it in my code . although i do not fully understand all the fine lines.
i did do some reading though.
going back two emails ago.
is there an AMD sample with data comming from feature layer?
I posted it earlier in this thread, but this version of the ClusterLayer is a FeatureLayer (almost) with clusters enabled.
odoe/esri-clusterfeaturelayer · GitHub
It takes a URL, does caching and more. It will even convert a service of polygons to points and cluster them. One of the samples tries to access an AGOL service that requires a login now though, so I need to update that.
Not that I know of. I don't think changing to a featureLayer gains you much, if anything. The whole idea of the cluster is that is processes all your records and determines which should be combined.
ok i moved on a little
now i am getting this error:
"Object doesn't support property or method 'setRenderer'"
when i look into the clusterlayer object during debug it doesnt have this method?
ok its working
and Tracy you were right there was a problem with the requires .
i added something to your function .
it draws the extent of the points that are concluded in the cluster you hover on.
clusterLayer.on(mouse-over", function (a)
{
if(clusterExtentGraphic != undefined)
{
map.graphics.remove(clusterExtentGraphic);
}
var geo = a.graphic.attributes.extent;
if (geo != undefined)
{
var lineSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH,
new dojo.Color([0, 0, 0]), 2));
var extent = new Extent(geo[0], geo[1], geo[2], geo[3], new SpatialReference({ wkid: 2039 }));
clusterExtentGraphic = new Graphic(extent, lineSymbol);
map.graphics.add(clusterExtentGraphic);
}
});
thanks ,
Avi Saroussi
Raven Radio.
Tracy,
Do you have a full working example of this that you would be willing to share?
Let me dig around. The problem is the project I created this for contains sensitive data, so the services are locked. I think this one is working: