/**
  * Merge WMS into this map
  * 
  * @return 
  */
 public function mergeWmsArray($wmsArray)
 {
     if (func_num_args() > 1 && is_array($wmsArray) && count($wmsArray) > 0) {
         $options = func_get_arg(1);
         if ($options["zoom"]) {
             $currentWms = $wmsArray[0];
             $bboxArray = array();
             for ($i = 0; $i < count($currentWms->objLayer[0]->layer_epsg); $i++) {
                 $bboxArray[] = Mapbender_bbox::createFromLayerEpsg($currentWms->objLayer[0]->layer_epsg[$i]);
             }
             $this->mergeExtent($bboxArray);
         }
         // visibility of WMS
         if (isset($options["visible"])) {
             if ($options["visible"]) {
                 // set all layers of WMS to visible
                 for ($i = 0; $i < count($wmsArray); $i++) {
                     $numLayers = count($wmsArray[$i]->objLayer);
                     // using option show is dependent to option visible = true
                     if ($options["show"] && is_numeric($options["show"])) {
                         // do not display if layer count is too big
                         if ($numLayers > intval($options["show"])) {
                             continue;
                         }
                     }
                     for ($j = 0; $j < $numLayers; $j++) {
                         $wmsArray[$i]->objLayer[$j]->gui_layer_visible = 1;
                     }
                 }
             } else {
                 // set all layers of WMS to visible
                 for ($i = 0; $i < count($wmsArray); $i++) {
                     $numLayers = count($wmsArray[$i]->objLayer);
                     for ($j = 0; $j < $numLayers; $j++) {
                         $wmsArray[$i]->objLayer[$j]->gui_layer_visible = 0;
                     }
                 }
             }
         }
         // querylayer
         if (isset($options["querylayer"])) {
             $val = $options["querylayer"] ? 1 : 0;
             // set all queryable layers of WMS to querylayer
             for ($i = 0; $i < count($wmsArray); $i++) {
                 $numLayers = count($wmsArray[$i]->objLayer);
                 for ($j = 0; $j < $numLayers; $j++) {
                     $currentLayer = $wmsArray[$i]->objLayer[$j];
                     if ($currentLayer->gui_layer_queryable) {
                         $currentLayer->gui_layer_querylayer = $val;
                     }
                 }
             }
         }
         if ($options["show"] && is_numeric($options["show"]) && !isset($options["visible"])) {
             $e = new mb_exception("show");
             // set all layers of WMS to visible
             for ($i = 0; $i < count($wmsArray); $i++) {
                 $numLayers = count($wmsArray[$i]->objLayer);
                 // do not display if layer count is too big
                 if ($numLayers > intval($options["show"])) {
                     continue;
                 }
                 for ($j = 0; $j < $numLayers; $j++) {
                     $wmsArray[$i]->objLayer[$j]->gui_layer_visible = 1;
                 }
             }
         }
     }
     $this->wmsArray = wms::merge(array_merge($this->wmsArray, $wmsArray));
 }
                // make WMS visible if it has less than 100000 layers
                $options["show"] = 100000;
            }
            if (isset($input["querylayer"])) {
                $options["querylayer"] = $input["querylayer"];
            }
            $wmcGetApi->mergeWmsArray(array($wms), $options);
            // do not use "zoom" attribute of mergeWmsArray,
            // as this would zoom to the entre WMS.
            // Here we set extent to the layer extent only.
            if ($input["zoom"]) {
                $bboxArray = array();
                try {
                    $layer = $wms->getLayerById(intval($input["id"]));
                    for ($i = 0; $i < count($layer->layer_epsg); $i++) {
                        $bboxArray[] = Mapbender_bbox::createFromLayerEpsg($layer->layer_epsg[$i]);
                    }
                    $wmcGetApi->mainMap->mergeExtent($bboxArray);
                } catch (Exception $e) {
                }
            }
        }
    }
}
//
// FEATURETYPE
//
$inputFeaturetypeArray = $getApi->getFeaturetypes();
if ($inputFeaturetypeArray) {
    $wfsConfIds = array();
    foreach ($inputFeaturetypeArray as $input) {