Trying to Integrate 3.0 ClusterLayer

4906
19
06-29-2012 06:22 AM
MarkHoover
Occasional Contributor II
Hello,

I'm trying to integrate the new ClusterLayer sample introduced at 3.0 (http://help.arcgis.com/en/webapi/javascript/arcgis/demos/layers/layers_point_clustering.html) into my application but I'm having some problems with the dojo.require statement.

So, I've included the dojo.require("extras.Clusterlayer"); statement in my Default.aspx page.  But when I try to load my application with that statement included, it fails to load...I just end up with a blank page.  Then I saw this code in the sample:

<script>
var dojoConfig = {
parseOnLoad: true,
packages: [{
"name": "extras",
"location": location.pathname.replace(/\/[^/]+$/, '') + "/extras"
}]
};
</script> 


So I included it in mine and still nothing.  I realized the "location" property's pathname was probably incorrect, but I've tried everything I can think of, including setting "location" to "help.arcgis.com/en/webapi/javascript/arcgis/demos/layers/extras" which I assume is what it must be in the sample but no dice.

Can anyone instruct me on what I'm doing wrong here?  Thanks!
0 Kudos
19 Replies
MarkHoover
Occasional Contributor II
Indeed, simply copying the sample code and trying to run it locally produces the same problem.  Any assistance available?
0 Kudos
MarkHoover
Occasional Contributor II
ESRI, any help?
0 Kudos
KellyHutchins
Esri Frequent Contributor
I just ran a quick test using the cluster sample code and was able to run it locally. Here are the steps I performed:
1. Downloaded the zip file containing the cluster code from here:
http://www.arcgis.com/home/item.html?id=4174dcae65bf42e1b776c17da4b279c1
2.Unzip the contents into a folder called cluster in  my web server root direction (c:/inetpub/wwwroot)
3.Test the app in my browser
http://localhost/cluster/layers_point_clustering.html

Indeed, simply copying the sample code and trying to run it locally produces the same problem.  Any assistance available?
0 Kudos
ReneRubalcava
Frequent Contributor
This was discussed in a previous thread, but also make sure that your server environment is configured to serve .json, as that is how the point data for this sample is stored under the "/data" folder.
0 Kudos
MarkHoover
Occasional Contributor II
Finally got it working...aiming at the correct path to parse the extras library proved a pain, but it works!

Now then, I think there is a small fault in the extras/ClusterLayer.js file included in Esri's sample.  There is a line of code that says:

alert('Sorry, that cluster contains more than 1000 points.  Zoom in for more detail.');


I submit it should say:

alert('Sorry, that cluster contains more than ' + this._maxSingles + ' points. Zoom in for more detail.');


As maxSingles is an option provided to the user during configuration of a new ClusterLayer.

Thanks,
Mark
0 Kudos
derekswingley1
Frequent Contributor
Now then, I think there is a small fault in the extras/ClusterLayer.js file included in Esri's sample.  There is a line of code that says:

alert('Sorry, that cluster contains more than 1000 points.  Zoom in for more detail.');


I submit it should say:

alert('Sorry, that cluster contains more than ' + this._maxSingles + ' points. Zoom in for more detail.');


As maxSingles is an option provided to the user during configuration of a new ClusterLayer.

Thanks,
Mark


You're right, I'll make the change.
0 Kudos
ManvinderKaur
New Contributor
i don't see extras/ClusterLayer.js  in the downloaded code. Am i missing something ?
Thanks
0 Kudos
lijack
by
New Contributor
i don't see extras/ClusterLayer.js in the downloaded code too.And i can't find it in the dojo library.where it is?
thanks
0 Kudos
derekswingley1
Frequent Contributor
i don't see extras/ClusterLayer.js in the downloaded code too.And i can't find it in the dojo library.where it is?
thanks


We made an update and missed adding the extras directory and ClusterLayer.js file to the download. I fixed this yesterday. Please re-download:  http://www.arcgis.com/sharing/content/items/1a6528fd3c774cfbbdf46df66c42958f/data
0 Kudos