What is the difference of using png/svg in Pushpin - option icon? RRS feed

  • Question

  • Hi,

    I add a Pushpin on the map with some coordinates. Now I want to set a custom icon for this Pushpin. So if I use:

    - PNG in the icon option, PNG icon size is 100px/100px. PNG is displayed on the map - and the Pushpin Point is located just in the middle (CENTER) on the PNG icon, which is perfect for me.

    - SVG in the icon option, SVG icon size is 100px/100px. SVG is diplayed on the map, but the Pushpin Point is located in the top left side of the map. Why this is happening? I want SVG icon to be displayed, just like the PNG - pushpin point to be in the center of the SVG?

    Currently Pushpin HtmlContent property is depricated on Bing Maps8. I have a pushpin with custom PNG icon and I want when this Pushpin is clicked to have a border color changed on this PNG icon - so it is selected. Is any way to achieve this?

    I attached two files so you can see that I added a Pushpin with Icon - SVG.

    1st attachment is the current situation

    2nd is what I want to achieve

    Wednesday, September 21, 2016 7:17 AM


  • I just found the solution - it's with using the Option - Anchor element  and setting the point inside it

    For example - pushpin option

    options["anchor"] = new Microsoft.Maps.Point(20,20);

    • Edited by Emo Stack Wednesday, September 21, 2016 2:07 PM more explanation
    • Marked as answer by Emo Stack Wednesday, September 21, 2016 2:07 PM
    Wednesday, September 21, 2016 2:06 PM