locked
How to get a tile with a transparent background? RRS feed

  • Question

  • I am generating a map tile using the Bing Maps REST API. I would like to set certain parts of the map to transparent. This is to be able to overlay the image tile on other images.

    Currently image tiles are generated by getting the image tile URL:

    http://dev.virtualearth.net/REST/V1/Imagery/Metadata/RoadOnDemand?output=xml&format=png&include=ImageryProviders&key=[YOUR KEY]

    Which gives a response containing:

    http://ak.dynamic.{subdomain}.tiles.virtualearth.net/comp/ch/{quadkey}?mkt=en-US&it=G,L&shading=hill&og=124&n=z&c4w=1

    If you replace the relevant {} sections and also add on the style you get:

    http://ak.dynamic.t0.tiles.virtualearth.net/comp/ch/3000?mkt=en-US&it=G,L&shading=hill&og=124&n=z&c4w=1&st=me|lv:0_ar|v:0_trs|v:0_cr|bsc:444444;boc:00000000;fc:888888;v:1_ad|bv:0_wt|fc:0000ff00_pt|v:0

    Which gives a the URL for a jpg image. Removing &shading=hill from the URL gives a png image. However the map seems to have a beige background set. (The water which is set to transparent appears as beige, which indicates that there is a beige background.) How am I able to have a transparent background instead?

    So that you get something like this:

    http://ecn.t2.tiles.virtualearth.net/tiles/ho12022?g=671&mkt=fr-fr&lbl=l1&stl=h

    Any suggestions would be appreciated.

    Tuesday, October 24, 2017 11:55 AM

Answers