none
Map Printing in V7............................ RRS feed

  • Question

  • In V6.3 we are using this code:

                         var targetDiv = document.getElementById("map");
                         var imgs = targetDiv.getElementsByTagName("img");
                         var divs = targetDiv.getElementsByTagName("div");

    to get the url's of the quadkey png files and the pushpins and then assembling these into one JPG file using graphics routines including HTMLSnapShooter.

    It's worked quite well for us and enabled us to serve up a JPG file with just the map in it along with the pushpins on the map.

    My question is that in V7 where have the url's for the quadkeys (PNG files on the map) gone to ?   They are not where they were in V6.3.

    Any help in this would be appreciated.  I'd also be willing to share our map printing code with the community.


    Steve Kahler
    • Moved by Ricky_Brundritt Friday, March 9, 2012 4:17 PM (From:Bing Maps: Map Control and Web services Development)
    Tuesday, March 8, 2011 2:43 PM

Answers

  • The tile image URLs change periodically, and are not generally designed to be hit directly. For printing purposes, I always call the REST imagery service to create a static map image based on the visible bounds of the current map window - this just retrieves a single image (with overlaid pushpins if necessary) which is dead-easy to print.

    http://msdn.microsoft.com/en-us/library/ff701724.aspx


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Tuesday, March 8, 2011 3:17 PM
    Moderator
  • Take a look what I did with the SOAP services to support custom icons and an unlimited number of pushpins: http://rbrundritt.wordpress.com/2008/10/25/ve-imagery-service-and-custom-icons/ The same process can be used with the REST service.

    Windows Live Developer MVP - http://rbrundritt.spaces.live.com | http://inknowledge.co.uk
    Tuesday, March 8, 2011 10:17 PM

All replies

  • The tile image URLs change periodically, and are not generally designed to be hit directly. For printing purposes, I always call the REST imagery service to create a static map image based on the visible bounds of the current map window - this just retrieves a single image (with overlaid pushpins if necessary) which is dead-easy to print.

    http://msdn.microsoft.com/en-us/library/ff701724.aspx


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Tuesday, March 8, 2011 3:17 PM
    Moderator
  • Thanks for the lilnk to getting a static map but this won't work for us as we are currently getting the custom tile layers and the pushpins which cannot be gotten using REST.

    I know that the tile image URL's change periodically but where are they in the web pages document object model ?

     


    Steve Kahler
    Tuesday, March 8, 2011 4:47 PM
  • You can find them pretty easily with Firebug. Here's the CSS path for them:

    html body div#map div.MicrosoftMap div div div img


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Tuesday, March 8, 2011 5:40 PM
    Moderator
  • I wasn't waiting for the map to load that's why I wasn't seeing them in the DOM.

    I found that this code does the trick:

            var targetDiv = document.getElementById("map");
            var imgs = targetDiv.getElementsByTagName("IMG");

    All of the tiles including custom tile layers are in there and the PushPins as well.

     


    Steve Kahler
    Tuesday, March 8, 2011 5:43 PM
  • Steve; you mentioned you'd be willing to share your map printing code.  I would be interested in seeing it.  Ajax v6.x correct?

     

    Thxs.

    Tuesday, March 8, 2011 7:40 PM
  • According the static imagery website for the Bing Maps control you can only have 18 pushpins drawn on the static image at a time.  I also do not see how you would draw the same custom pins on a static image.

    http://msdn.microsoft.com/en-us/library/ff701724.aspx

    I am interested in being able to print large sets of points for regions of the United States.  I have a plotter than can print E/A0 size (roughly 34" x 44").  I need to be able for the user to hit a print button the map page and send which they see in the map control to the printer.  There could easily be over a hundred points per region.  Any ideas if this is possible from the web control or MapPoint?

    Tuesday, March 8, 2011 8:15 PM
  • Take a look what I did with the SOAP services to support custom icons and an unlimited number of pushpins: http://rbrundritt.wordpress.com/2008/10/25/ve-imagery-service-and-custom-icons/ The same process can be used with the REST service.

    Windows Live Developer MVP - http://rbrundritt.spaces.live.com | http://inknowledge.co.uk
    Tuesday, March 8, 2011 10:17 PM