次の例では、Roads 画層のラベルを Roads と Streets の間で切り替えます。
MgInitializeWebTier ($webconfigFilePath); $userInfo = new MgUserInformation($mgSessionId); $siteConnection = new MgSiteConnection(); $siteConnection->Open($userInfo); $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService); $map = new MgMap(); $map->Open($resourceService, $mgMapName); $layers = $map->GetLayers(); $roadLayer = $layers->GetItem('Roads'); $roadLabel = $roadLayer->GetLegendLabel(); if ($roadLabel == 'Roads') $newLabel = 'Streets'; else $newLabel = 'Roads'; $roadLayer->SetLegendLabel($newLabel); // You must save the updated map or the // changes will not be applied // Also be sure to refresh the map on page load. $map->Save($resourceService);