Adding An Existing Layer To A Map

If the layer already exists in the resource repository, add it to the map by getting the map’s layer collection and then adding the layer to that collection.

    $layerCollection = $map->GetLayers();

    $layerCollection->Add($layer);

By default, newly added layers are added to the bottom of the drawing order, so they may be obscured by other layers. If you want to specify where the layer appears in the drawing order, use the $layerCollection->Insert() method. For an example, see Adding Layers To A Map.

NoteIn the MapGuide API, getting a collection returns a reference to the collection. So adding the layer to the layer collection immediately updates the map.