Point clustering - zoom to layer extent upon creation

Discussion created by tligon on Apr 26, 2013
I'd like to zoom to the extent of the cluster layer when it is created. The request I'm using is: map.setExtent(esri.graphicsExtent( However, there's a couple of problems:

  • If the cluster layer has only one cluster, there's no extent

  • If the cluster layer has a few clusters, zooming to the cluster layer extent triggers a cluster recalculation, which almost always makes the zoom extent smaller than the layer's extent after the recalculation

Hoping this isn't the only solution, but the only way I see around this is to maintain an extent inside the cluster layer and update it with minX, maxX, minY, and maxY values as each point is being evaluated for placement in the _clusterGraphics function.

Open to better suggestions...