none
how do add an image in a tile source RRS feed

  • Question

  • Hi All, I have to add a trasparent image over a map: this is the image

    I add the image to the control using this code:

    this.currentMap.entities.clear();
                                var options: Microsoft.Maps.TileSourceOptions = { uriConstructor: url, width: bing.getMapActualWidth(), height: bing.getMapActualHeight() };
                                
                                var tileSource: Microsoft.Maps.TileSource = new Microsoft.Maps.TileSource(options);
                                var tilelayer: Microsoft.Maps.TileLayer = new Microsoft.Maps.TileLayer({ mercator: tileSource });
                                this.currentMap.entities.push(tilelayer);  
    

    but the image is rended incorrectly, placed in an incorrect position. How can I be sure that the topleft corner of the image is placed over the topleft corner of the map?

    thanks,

      luca

    Tuesday, September 23, 2014 4:30 AM

Answers

All replies

  • Hi All, I have to add a trasparent image over a map: this is the image

    I add the image to the control using this code:

    this.currentMap.entities.clear();
                                var options: Microsoft.Maps.TileSourceOptions = { uriConstructor: url, width: bing.getMapActualWidth(), height: bing.getMapActualHeight() };
                                
                                var tileSource: Microsoft.Maps.TileSource = new Microsoft.Maps.TileSource(options);
                                var tilelayer: Microsoft.Maps.TileLayer = new Microsoft.Maps.TileLayer({ mercator: tileSource });
                                this.currentMap.entities.push(tilelayer);  
    

    but the image is rended incorrectly, placed in an incorrect position. How can I be sure that the topleft corner of the image is placed over the topleft corner of the map?

    thanks,

      luca

    looks like is not tiled correclty

    Tuesday, September 23, 2014 5:04 AM
  • Unless you break your image into a bunch of tile images you won't want to use a TileLayer to add your image to the map. Instead you will want to scale and position the image over the map as the map moves. This will allow you to only have a single image instead of a bunch of tiles. I have a blog post and code sample on how to do this here:

    http://blogs.bing.com/maps/2013/05/22/image-overlays-with-bing-maps-javascript/

    https://bingmapsv7modules.codeplex.com/wikipage?title=Image%20Overlays


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Tuesday, September 23, 2014 8:09 AM
    • Marked as answer by luca morelli Tuesday, September 23, 2014 1:36 PM
    Tuesday, September 23, 2014 8:09 AM