mattlane86

BaseMapGallery missing features and suggestions

Discussion created by mattlane86 on Jul 6, 2012
I like the BaseMapGallery widget, even when I don't need the ArcGIS online maps and thumbnails, simply because it toggles the relevant layers for me and allows me to add "overlay" layers in a basemap easily.

For example: http://jsfiddle.net/uYLu3/

What I've run across and can't find any solutions for, is that I can't specify the BasemapLayer "id" or change a specific BasemapLayer's visibility. For example, I can't toggle the overlay layer off or on.

I've hacked up a solution here: http://jsfiddle.net/qfH3W/1/

relevant code:
var layer = bmg.get("baseCanvas").getLayers()[0];
layer.visibility = !layer.visibility;
bmg.select("baseCanvas");


In that I had to put in the known array index because I don't know the layer id at run-time. The other trick for this would be to search for a string in the layer URL maybe. I also had to re-select the Basemap to get it to update the change in visibility.

Outcomes