Basic Layer Properties

A map contains one or more layers (MgLayer objects) that are rendered to create a composite image. Each layer has properties that determine how it displays in the map and map legend. Some of the properties are:

- Layer name: A unique identifier
- Legend label: The label for the layer as it appears in the map legend.
- Visibility: whether the layer should be displayed in the map. Note that actual visibility is dependent on more than just the visibility setting for a layer. See Layer Visibility for further details.
- Selectable: Whether features in the layer are selectable. This only applies to layers containing feature data.

The MgMap::GetLayers() method returns an MgLayerCollection object that contains all the layers in the map. The MgLayerCollection::GetItem() method returns an individual MgLayer object, by either index number in the collection or layer name.

Layers in the collection are sorted by drawing order, with the top layers at the beginning of the collection. For example, using PHP syntax, if $layers is a collection containing the layers in a map, then $layers->GetItem(0) returns the top-most layer.