Point clustering

1110
8
Jump to solution
04-17-2013 03:21 PM
RobertPincus
New Contributor III
I have been trying to modify the Point clustering sample found here
http://www.arcgis.com/home/item.html?id=4174dcae65bf42e1b776c17da4b279c1
to use the results of a query task without much luck.

Can anyone provide a modified version that uses a query task?

Thanks,
Robert
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Frequent Contributor
Here's an example that uses a query task to get data from a map service and puts it in the format expected by the cluster layer:  http://dl.dropboxusercontent.com/u/2654618/query_task_point_clustering/index.html

I didn't change anything in extras/ClusterLayer.js. The dojo.map statement that creates an array of objects in the format expected by the cluster layer in the addClusters function is probably the piece you were missing.

View solution in original post

0 Kudos
8 Replies
derekswingley1
Frequent Contributor
Here's an example that uses a query task to get data from a map service and puts it in the format expected by the cluster layer:  http://dl.dropboxusercontent.com/u/2654618/query_task_point_clustering/index.html

I didn't change anything in extras/ClusterLayer.js. The dojo.map statement that creates an array of objects in the format expected by the cluster layer in the addClusters function is probably the piece you were missing.
0 Kudos
TomasNovotny
New Contributor
Hi Derek,
any chance to get point clustering to API? It would be really nice.

Atb,
Tomas
@tonovotny
0 Kudos
BetsySchenck-Gardner
Occasional Contributor
Derek in your example, you are querying against a featureserver. Can you query against a mapserver instead or does it have to be a featureserver to do clustering?
0 Kudos
derekswingley1
Frequent Contributor
Hi Derek,
any chance to get point clustering to API? It would be really nice.


We'd like to do it but we don't have a timeline for making it happen.
0 Kudos
derekswingley1
Frequent Contributor
Derek in your example, you are querying against a featureserver. Can you query against a mapserver instead or does it have to be a featureserver to do clustering?


This is the type of thing that's easy to test and figure out on your own :).

The answer is yes, you can query against a layer in map service. I used a feature service because it was readily available.
0 Kudos
BetsySchenck-Gardner
Occasional Contributor
Sometimes it's just easier to ask and not waste hours trying to get it to work 🙂
0 Kudos
DawenXie
New Contributor III
Just a quick note: as long as the data is prepared in the way the clusterLayer class expects, it can be from any source.

This is the type of thing that's easy to test and figure out on your own :).

The answer is yes, you can query against a layer in map service. I used a feature service because it was readily available.
0 Kudos
RobertPincus
New Contributor III
Thank you Derek for your help. I got the clustering to work. I think I had most of it correct yesterday, but the layer that I was clustering was in a different spatial reference than the base layer. Once I altered the cluster layer's spatial reference to match that of the base layer everything works.

One more question. Is there a way to set scale dependencies for the cluster layer? I want to be able to turn it off at 1:10,000 and then show the original layer.

Thanks,
Robert
0 Kudos