<? // first get an unused layer ID (unique to service) $sel_ID=$imsMap->getMaxLayerID()+1; // create a dataset based on layer 4 in the service $Dset=new arcLayerDataset(4); // create the new featureclass layer and name it "newLayerName" $selLayer=new arcLayer($sel_ID,1,"newLayerName"); // set the datasource for the new layer $newLayer->setDataset($Dset); // make the layer visible on the map $newLayer->Visible=1; // add the layer to the map, it will be added to the end of the layerlist $imsMap->Layers[]=$newLayer; ?>