none
v7 Multiple pushpins at same location RRS feed

  • Question

  • Hi,
    
    When my result set of locations, coming from the server in JSON, happen to have the same lat & long, 
    
    only one pushpin is displayed with attributes & event handler from the last location. 
    
    Is there a way to "explode" the icons or somehow indicate that the pushpin is really a stack of locations?
    
     
    
    Here's what I have so far:
    
    function AddPushpins(resultSet) {
      map.entities.clear();
      var locs = []; // = new Microsoft.Maps.EntityCollection();
    
      //Get the location contents
      for (var i in resultSet) {
        var loc = new Microsoft.Maps.Location(resultSet[i].Lat, resultSet[i].Long);
        // Add a pin to the map
        var pin = new Microsoft.Maps.Pushpin(loc, { text: resultSet[i].Id.toString() });
        pushpinClick = Microsoft.Maps.Events.addHandler(pin, 'click', displayEventInfo);
        pin.setInfoBox(new InfoBox("<strong>Pushpin #" + resultSet[i].Id.toString() + "</strong><hr />This is the description of Pushpin " + resultSet[i].Id.toString() + ". <br/><img src=\"http://www.microsoft.com/maps/images/bing_m1.png\" alt=\"Bing logo\">"));
        map.entities.push(pin);
        locs.push(loc);
      }
    }
    

     

    Thanks!

    • Moved by Ricky_Brundritt Friday, March 9, 2012 5:47 PM (From:Bing Maps: Map Control and Web services Development)
    Sunday, May 29, 2011 2:20 AM

Answers

All replies

  • There is nothing built into the current v7 api to support this at the moment. Take a look at Ricky's client side clustering solution which will give you an option for this issue:

     

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


    Brian @ Earthware - UK interactive mapping web developers http://www.earthware.co.uk/blog | http://www.twitter.com/earthware | Windows Live Developer MVP
    • Marked as answer by Jill Mc Sunday, June 5, 2011 11:06 PM
    Sunday, May 29, 2011 7:30 AM
    Moderator
  • Try http://www.bingmapsportal.com/ISDK/AjaxV7 dynamic module section which shows module to enable clustering
    HemantGoyal
    • Marked as answer by Jill Mc Sunday, June 5, 2011 11:07 PM
    Monday, May 30, 2011 4:55 AM
  • Thanks for your response.

    What a huge bummer.  I understand MS wanted to lighten the API but I do not understand removing this functionality in the new API. 

    Now I either need to do major surgery or switch to google maps... :-(

     

    Sunday, June 5, 2011 11:12 PM
  • "...Now I either need to do major surgery or switch to google maps... :-("

    There's no denying that upgrading a Bing Maps v6.x application to v7.x involves some substantial code rewriting, but switching to Google Maps involves a completely new API (and licensing model) - I don't see how that could possibly be a better alternative!

    v6.x will be around for a while so, although you're right to be looking at upgrading to v7 now, there's no massive hurry - your v6 application for quite a while yet.


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Monday, June 6, 2011 7:44 AM
    Moderator