Layer Visibility

Open($userInfo); $map = new MgMap($siteConnection); $map->Open($mapName); $layers = $map->GetLayers(); // Get layer collection echo "

Layers, in draw order:

"; echo ''; echo ''; $count = $layers->GetCount(); for ($i = 0; $i < $count; $i++) { $layer = $layers->GetItem($i); echo "\n"; } echo '
LayerGetVisible()IsVisible()
" . $layer->GetName() . "" . ($layer->GetVisible() ? 'on' : 'off') . "" . ($layer->IsVisible() ? 'on' : 'off') . "
'; } catch (MgException $e) { echo "

Error: "; echo $e->GetDetails(); echo "

"; } ?>

GetVisible() returns the state of the visibility flag for a given layer (the check box in the Layers pane). IsVisible() returns the actual visibility of a layer, based on its visibility flag, the visibility flag of any groups that include the layer, and whether the layer has a defined style for the current view scale.