Trying to Integrate 3.0 ClusterLayer

4917
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
lijack
by
New Contributor
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


thank you for your help. but i also can't run the api that [URL="http://help.arcgis.com/en/webapi/javascript/arcgis/demos/layers/layers_point_clustering.html"] successfully by vs2008. at first,the firebug note me that extras/ClusterLayer.js not found. but after extras/ClusterLayer.js added to dojo library,the firbug note me that map.js not found. so i want know what happen.
thanks, I am a novice programming.
0 Kudos
derekswingley1
Frequent Contributor
0 Kudos
lijack
by
New Contributor
Does this link work in your browser:  http://help.arcgis.com/en/webapi/javascript/arcgis/demos/layers/layers_point_clustering.html


yes.this link can  work in my browser.but the layers_point_clustering.html file can't work in my browser after the file double clicked.my aim is the file can work in my browser.
so how to do about this.
thanks.
0 Kudos
derekswingley1
Frequent Contributor
the layers_point_clustering.html file can't work in my browser after the file double clicked.my aim is the file can work in my browser.


Rather than running the sample by double-clicking it, you need to use a web server (like IIS or Apache). Your web server can be local. The important part is that you run JS API samples over http:// rather than file://.
0 Kudos
lijack
by
New Contributor
Rather than running the sample by double-clicking it, you need to use a web server (like IIS or Apache). Your web server can be local. The important part is that you run JS API samples over http:// rather than file://.


I used the web server(IIS),it can work but also have some problem.It just show a map without the point.The firebug note me that Error: Unable to load data/1000-photos.json status:404
0 Kudos
derekswingley1
Frequent Contributor
Try loading the .json file directly in your browser. If you still get a 404, and you're sure that the path to the file is correct, you probably need to configure IIS to server JSON:  http://stackoverflow.com/q/332988/1934
0 Kudos
lijack
by
New Contributor
Try loading the .json file directly in your browser. If you still get a 404, and you're sure that the path to the file is correct, you probably need to configure IIS to server JSON:  http://stackoverflow.com/q/332988/1934


Thank you very much.It's work in my IIS server.
0 Kudos
ZhiLiu
by
New Contributor
When I added the point clustering js to my project with other js files, the error "esri is not defined" occurred.  How to fix this bugs?  Thanks!
0 Kudos
derekswingley1
Frequent Contributor
When I added the point clustering js to my project with other js files, the error "esri is not defined" occurred.  How to fix this bugs?  Thanks!


This usually happens when you try to reference something in the library before it's been loaded. We mention this in the Migrating to 3.0 doc.
0 Kudos
ZhiLiu
by
New Contributor
This usually happens when you try to reference something in the library before it's been loaded. We mention this in the Migrating to 3.0 doc.


Ok, it works fine now. 

Another question:  How to automatically zoom in the selected cluster by one click, then show the points?
0 Kudos