esri.ux.layers.ClusterLayer with latest JS API?

5080
8
09-17-2013 09:37 AM
TimDine
Occasional Contributor II
Has anyone been able to make this work with the lastest JS API?  I'm trying to make the sample work by only changing the api references and have started trying to convert the code, but am getting stumped pretty early.

dojo.declare('esri.ux.layers.ClusterLayer', esri.layers.GraphicsLayer, {


is right at the top in the declaration of the class and it blows up thinking the GraphicsLayer is "null or undefined".

Thoughts?
0 Kudos
8 Replies
RobertHupp
New Contributor III
I'm trying to do the same thing and I'm having the same issue with that declare, any help would be greatly appreciated!
0 Kudos
EdwardSohn2
New Contributor III

Got it to work to a degree:

used the following for esri.ux.layers.ClusterLayer-debug.js file.

define([

    "dojo/_base/declare",

    "esri/layers/GraphicsLayer",

    "dojox/lang/functional",

    "dojox/lang/functional/lambda",

    "dojox/lang/functional/curry",

    "dojox/lang/functional/fold"

], function (

    declare, GraphicsLayer

    ) {

    return declare([GraphicsLayer], {

        constructor: function (options) {

... //rest of it like the esri.ux.layers.ClusterLayer-debug.js file

// sorry may not be allowed to post the rest of it due to company privacy

// please see below comments

    });

});

Also at every "new esri.geometry.Point(...)" statement has to be converted to new esri.geometry.Point(..., this._map.spatialReference) where the spatial reference has to be specified, else it will default to 4326.

Also lot of the references to map was bombing out as null.  I just replaced them with this._map which is being set in the constructor.

ChrisFourroux
New Contributor

I was working on this today too. Looks like you got a lot further than this beginner (me) did.
I tried your solution  and  updated the index.html with

<script src="//js.arcgis.com/3.12/"></script>

and receive a mulitpleDefine error. any ideas?

0 Kudos
ReneRubalcava
Frequent Contributor

I created an updated version of the ClusterLayer that works with services, similar to a FeatureLayer, but with same added sugar.

You can read more about it here.

Esri ClusterFeatureLayer - odoenet

Here is a GeoNet blog post here

Let's talk clusters.

The source code can be found here

odoe/esri-clusterfeaturelayer · GitHub

0 Kudos
ChrisFourroux
New Contributor

Thank you. That provided me with enough info to get esri.ux.layers.ClusterLayer-debug.js working with the latest JS API.
I'm just tracking down one last issue with mouse over infoWindows

0 Kudos
LadislavRozkosny
New Contributor

Scripts, which you posted is very good, but thay haven't "flare effect". I need this functionality together with the script above. I'm novice in JavaScript and I can't do it. Can you give me some advice or can you implement this functionality? I think that for someone who knows how it will be easy.

0 Kudos
ReneRubalcava
Frequent Contributor

Someone put together a FlareClusterLayer that may be what you are looking for.

nickcam/FlareClusterLayer · GitHub

LadislavRozkosny
New Contributor

Rene,

The script, which you post is script for json data. Can you describe how can i change it for featurelayer?

0 Kudos