Exemplo n.º 1
0
    $featureSrvc = $site->CreateService(MgServiceType::FeatureService);
    $renderingSrvc = $site->CreateService(MgServiceType::RenderingService);
    $resourceSrvc = $site->CreateService(MgServiceType::ResourceService);
    //load the map runtime state
    //
    $map = new MgMap();
    $map->Open($resourceSrvc, $mapName);
    $layers = explode(",", $layers);
    if (count($layers) > 0) {
        $layerNames = new MgStringCollection();
        for ($i = 0; $i < count($layers); $i++) {
            $layerNames->Add($layers[$i]);
        }
        // create a multi-polygon or a multi-geometry containing the input selected features
        //
        $inputGeom = MultiGeometryFromSelection($featureSrvc, $map, $inputSel);
        if ($inputGeom) {
            // Query all the features belonging the the layer list that intersects with the input geometries
            //
            $fi = $renderingSrvc->QueryFeatures($map, $layerNames, $inputGeom, MgFeatureSpatialOperations::Intersects, -1);
            if ($fi) {
                $resultSel = $fi->GetSelection();
                if ($resultSel) {
                    //return XML
                    header("Content-type: text/xml");
                    echo $resultSel->ToXml();
                }
            }
        }
    }
} catch (MgException $e) {
Exemplo n.º 2
0
    $result->hasSelection = false;

    /*holds selection array*/
    $properties = NULL;
    $properties->layers = array();

    $layers = explode(",", $layers);
    if (count($layers) > 0) {

      $layerNames = new MgStringCollection();
      for ($i = 0; $i < count($layers); $i++) {
        $layerNames->Add($layers[$i]);
      }

      // create a multi-polygon or a multi-geometry containing the input selected features
      $inputGeom = MultiGeometryFromSelection($featureSrvc, $resourceService, $map, $mapName);
      if ($inputGeom) {
        // Query all the features belonging the the layer list that intersects with the input geometries
        $fi = $renderingSrvc->QueryFeatures($map, $layerNames, $inputGeom, MgFeatureSpatialOperations::Intersects, -1);
        if ($fi) {
          $resultSel = $fi->GetSelection();
          if( $resultSel) {
            $resultSel->Save($resourceService, $mapName);

            //this needs to be re-opened for some reason
            $resultSel = new MgSelection($map);
            $resultSel->Open($resourceService, $mapName);

            $layers = $resultSel->GetLayers();
            if ($layers && $layers->GetCount() >= 0) {
              $result->hasSelection = true;