none
How to embed Bing Map into power point RRS feed

  • Question

  • I am working in a application that is using Bing (AJAX) to generate a map object to a webpage.

    In addition to creating the map, we are using the API to add pushpins and create polygons that we color to highlight an area on the map.

    What I would like to do is to be able to embed that final map image into another document such as word or powerpoint.

    Once I have a generated map how can I go about embedding it? In my markup I don't an "img" tag.

    Please advise.

    Wednesday, November 25, 2015 3:50 PM

Answers

  • The AJAX map control is made up of a bunch of DOM elements and is not a simple image. There isn't an easy way to export an image of a bunch of DOM elements, however, one thing you could try is using an HTML to Canvas tool like this: http://html2canvas.hertzen.com/ Once it is an HTML5 canvas it is fairly easy to get an image from it. http://www.w3schools.com/tags/canvas_getimagedata.asp

    http://rbrundritt.wordpress.com

    Wednesday, November 25, 2015 5:57 PM
  • Right. I'm not too surprised that didn't work as this is something others have struggled to do too. I did tackle this scenario a while back and the solution is pretty big and requires generating the image on the server side. If you email me at ricky_brundritt at Hotmail.com I'll end you a copy of the code.

    In the future we are looking at ways to make it easier to export an image of the JavaScript map.


    http://rbrundritt.wordpress.com

    Wednesday, November 25, 2015 7:36 PM

All replies

  • The AJAX map control is made up of a bunch of DOM elements and is not a simple image. There isn't an easy way to export an image of a bunch of DOM elements, however, one thing you could try is using an HTML to Canvas tool like this: http://html2canvas.hertzen.com/ Once it is an HTML5 canvas it is fairly easy to get an image from it. http://www.w3schools.com/tags/canvas_getimagedata.asp

    http://rbrundritt.wordpress.com

    Wednesday, November 25, 2015 5:57 PM
  • Thanks for the suggestion, however that doesnt appear to be working.

    I generate the bing map image on my page and I have a button event to capture that image. 

    When it renders the copy of the image I see an outline of the map, no map image and none of the colored polygons that I originally created on the map.

    Wednesday, November 25, 2015 7:29 PM
  • Right. I'm not too surprised that didn't work as this is something others have struggled to do too. I did tackle this scenario a while back and the solution is pretty big and requires generating the image on the server side. If you email me at ricky_brundritt at Hotmail.com I'll end you a copy of the code.

    In the future we are looking at ways to make it easier to export an image of the JavaScript map.


    http://rbrundritt.wordpress.com

    Wednesday, November 25, 2015 7:36 PM