$featureReader->Close(); } } } if ($bExtendSelection) { $selection = new MgSelection($map); $queryOptions = new MgFeatureQueryOptions(); $layers = $map->GetLayers(); foreach ($aLayers as $szLayer => $aLayer) { $oLayer = $layers->GetItem($szLayer); foreach ($aLayer as $szClass => $aFilter) { /* get the feature source from the layer */ $featureResId = new MgResourceIdentifier($oLayer->GetFeatureSourceId()); $featureGeometryName = $oLayer->GetFeatureGeometryName(); $szFilter = implode(' OR ', $aFilter); $queryOptions->setFilter($szFilter); /* the class that is used for this layer will be used to select features */ $class = $oLayer->GetFeatureClassName(); /* select the features */ $featureReader = $featureService->SelectFeatures($featureResId, $class, $queryOptions); $selection->AddFeatures($oLayer, $featureReader, $maxFeatures); $layerName = $oLayer->GetName(); if (!in_array($layerName, $properties->layers)) { array_push($properties->layers, $layerName); } $featureReader->Close(); $featureReader = $featureService->SelectFeatures($featureResId, $class, $queryOptions); $spatialContext = $featureService->GetSpatialContexts($featureResId, true); $srsLayerWkt = false; if ($spatialContext != null && $spatialContext->ReadNext() != null) {