Bing Maps V8 Layer ZIndex issue RRS feed

  • Question

  • I'm in the process of converting an existing V7 application to Bing Maps V8 and have encountered a problem with setting the Layer ZIndex. If you set it to anything less than 1000 then polygons and polylines are not displayed. Pushpins are not affected. The following code will not work.

    var layer = new Microsoft.Maps.Layer();
    layer.add(Microsoft.Maps.TestDataGenerator.getPushpins(5, map.getBounds()));
    layer.add(Microsoft.Maps.TestDataGenerator.getPolygons(5, map.getBounds()));
    layer.add(Microsoft.Maps.TestDataGenerator.getPolylines(5, map.getBounds()));

    Changing the setZIndex parameter to 1000 or greater fixes the problem, but it took a great deal of head-scratching to work it out, given that all my ZIndexes were originally in single digits.

    Friday, July 1, 2016 8:52 AM


  • Yes, the V8 map control is much different when it comes to zIndex due to the new way things are rendered in V8 using the HTML5 canvas. I will sync up with the dev team to get exact details on this and will update this thread and also add details to the documentation.

    At a high level, by default, tile layers will always render below data layers/polylines/polygons, and pushpins will always render above everything except the active layer being used in the drawing tools and the map controls/logo/copyrights.

    [Blog] [twitter] [LinkedIn]

    Friday, July 1, 2016 4:41 PM
  • There has been other posts on this since this one. This is by design. The zindexing of V8 has been documented here:

    [Blog] [twitter] [LinkedIn]

    Thursday, May 4, 2017 3:47 PM

All replies