Bing map (veTileLayer) as basemap

602
2
Jump to solution
12-17-2012 10:46 AM
SebastianRoberts
Occasional Contributor III
I am working with the Tax Parcel Viewer template from the local government gallery.  I would like to add Bing Maps as a basemap.  I was able to modify the CreateBaseMapLayer to add a VeTileLayer as below, but I have two problems.  First the Bing Maps basemap draws on load, and the ChangeBaseMap function doesn't work properly.  How would I make the Bing layer not visible on load, and how do I get a reference to it using similar to "map.getLayer" so that I can update the ChangeBaseMap function? 
function CreateBaseMapLayer(layerURL, layerId, isVisible,bingKey) {     if (isVisible) {         currentBaseMap = layerId;     }  if (bingKey.length > 0 ){    veTileLayer = new esri.virtualearth.VETiledLayer({    bingMapsKey: bingKey,    mapStyle: esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL    });    return veTileLayer  }else{   var layer = new esri.layers.ArcGISTiledMapServiceLayer(layerURL, { id: layerId, visible: isVisible });   return layer;  } }
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Frequent Contributor
The bing layer works like other tiled layers in the API so if you don't want your bing layer to be visible initially, pass visible: false to the constructor.

The easiest way to be able to get a reference to a bing layer (or any layer for that matter) is to specify an id when creating the layer then pass that id to map.getLayer.

Here's an example:  http://jsfiddle.net/Srg9n/

View solution in original post

0 Kudos
2 Replies
SebastianRoberts
Occasional Contributor III
Anyone know how to toggle visibility on a Bing Map (veTileLayer)?
0 Kudos
derekswingley1
Frequent Contributor
The bing layer works like other tiled layers in the API so if you don't want your bing layer to be visible initially, pass visible: false to the constructor.

The easiest way to be able to get a reference to a bing layer (or any layer for that matter) is to specify an id when creating the layer then pass that id to map.getLayer.

Here's an example:  http://jsfiddle.net/Srg9n/
0 Kudos