none
Pin Offset RRS feed

  • Question

  • I appended this to another thread but got no response, so trying a new one, anyone know the issue here?

    .......When zooming in the icons are were they should be but when zooming out they are not.  The attached image shows icons that should all be in Massachusetts, which works great at lower zooms but as shown not when zoomed out.  I have attached an image for reference.  Also, here is the code drawing the icons:

     

     var loc1 = new Microsoft.Maps.Location(pointlat, pointlong);
    	            var pin = new Microsoft.Maps.Pushpin(loc1, { icon: imgName });
    	            pin.height = 15;
    	            pin.width = 28;
                    pin.anchor = new Microsoft.Maps.Point(8,15);
    	            pin.setInfoBox(new InfoBox("<font color=#1a529d><strong>" + icontitle + "</strong></font><hr /> " + icontext + "<br/>"));
    	            map.entities.push(pin);
    

    WeDoMapping
    • Moved by Ricky_Brundritt Saturday, March 10, 2012 12:32 PM (From:Bing Maps: Map Control and Web services Development)
    Friday, December 16, 2011 12:30 PM

Answers

  • You're trying to set the height, width, and anchor properties directly on the pin object itself. You should pass them in the options to the constructor method:

    var loc1 = new Microsoft.Maps.Location(pointlat, pointlong);
    var pin = new Microsoft.Maps.Pushpin(loc1, { icon: imgName, height: 15, width: 28, anchor: new Microsoft.Maps.Point(8,15) });
    pin.setInfoBox(new InfoBox("<font color=#1a529d><strong>" + icontitle + "</strong></font><hr /> " + icontext + "<br/>"));
    map.entities.push(pin);
    



    twitter: @alastaira blog: http://alastaira.wordpress.com/
    • Marked as answer by WeDoMapping Friday, December 16, 2011 1:10 PM
    Friday, December 16, 2011 1:00 PM
    Moderator

All replies

  • You're trying to set the height, width, and anchor properties directly on the pin object itself. You should pass them in the options to the constructor method:

    var loc1 = new Microsoft.Maps.Location(pointlat, pointlong);
    var pin = new Microsoft.Maps.Pushpin(loc1, { icon: imgName, height: 15, width: 28, anchor: new Microsoft.Maps.Point(8,15) });
    pin.setInfoBox(new InfoBox("<font color=#1a529d><strong>" + icontitle + "</strong></font><hr /> " + icontext + "<br/>"));
    map.entities.push(pin);
    



    twitter: @alastaira blog: http://alastaira.wordpress.com/
    • Marked as answer by WeDoMapping Friday, December 16, 2011 1:10 PM
    Friday, December 16, 2011 1:00 PM
    Moderator
  • PERFECT! Thank you very much!
    WeDoMapping
    Friday, December 16, 2011 1:10 PM