none
How to cluster all pins with locality x where zoom <= somePreset RRS feed

  • Question

  • Hi,

     

    First of all, my apologies for the myriad of threads. I'm nearing completion of my project, and I keep thinking of little enhancements. Clustering is one of them. I checked out this tutorial that Richard wrote - I'm wondering if it can be applied in a slightly different manner (http://msdn.microsoft.com/en-us/library/cc161072.aspx).

     

    On a map with pushpins, is it possible to cluster the pushpins when the zoom level is small enough (say, <=6) and cluster them not by grid cells, but by some other property (in my case, I'd use something like the locality - all pushpins that have "Township" as the municipality that are being displayed in the map will be clustered).

     

    If anyone has some resources or reference material I can read over, I'll start there and see what I can come up with.

     

    Thanks!

    • Moved by Ricky_Brundritt Friday, March 9, 2012 6:12 PM (From:Bing Maps: Map Control and Web services Development)
    Saturday, June 18, 2011 10:02 PM

Answers

  • Firstly, there's a more recent clustering algorithm (based on v7), here:

    http://www.bing.com/community/site_blogs/b/maps/archive/2011/03/01/bing-maps-v7-modular-design-and-client-side-clustering.aspx

    It's still based on simple grid-clustering, but illustrates a couple of different ways to assign pins to an individual cluster, based on the supplied ClusterPlacementType. In your case, you'd want to define a new ClusterPlacementType where the pin is assigned to a cluster not only based on the gridCell as currently, but where it also takes account of whatever additional property you want to group clusters by. So, for example, you could have a two-dimensional array: GridCells[GridKey][Township], and only cluster those pins that lay in the same cell and had the same property.

    To disable clustering at high zoom levels, just set clusteringEnabled to false when map.getZoom() > 6


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Sunday, June 19, 2011 6:51 AM
    Moderator

All replies

  • Firstly, there's a more recent clustering algorithm (based on v7), here:

    http://www.bing.com/community/site_blogs/b/maps/archive/2011/03/01/bing-maps-v7-modular-design-and-client-side-clustering.aspx

    It's still based on simple grid-clustering, but illustrates a couple of different ways to assign pins to an individual cluster, based on the supplied ClusterPlacementType. In your case, you'd want to define a new ClusterPlacementType where the pin is assigned to a cluster not only based on the gridCell as currently, but where it also takes account of whatever additional property you want to group clusters by. So, for example, you could have a two-dimensional array: GridCells[GridKey][Township], and only cluster those pins that lay in the same cell and had the same property.

    To disable clustering at high zoom levels, just set clusteringEnabled to false when map.getZoom() > 6


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Sunday, June 19, 2011 6:51 AM
    Moderator
  • Oh boy... Based on my current schedule I might have to let this idea sit for a bit. But thanks for the information. I'll definitely come back to this once I get the more important things done.

     

    Kevin

    Sunday, June 19, 2011 9:19 PM