[mapguide-users] Selection Issue (FeatureReader only grabbing 20 items)

nclayton nclayton at gmail.com
Wed Jul 23 11:09:43 EDT 2008


Here is my altered code to incorporate the workaround:
=============================================
function GetObjKeys($sessId,$mapName,$sel,$scnt){ 
  $obj_keys = ''; 
    if($sel != ''){ 
      InitializeWebTier(); 
      $userInfo = new MgUserInformation($sessId); 
      $siteConnection = new MgSiteConnection(); 
      $siteConnection->Open($userInfo); 
      $resourceService = 
$siteConnection->CreateService(MgServiceType::ResourceService); 
      $featureService = 
$siteConnection->CreateService(MgServiceType::FeatureService); 
      $map = new MgMap($siteConnection); 
      $map->Open($resourceService,$mapName); 
      $selection = new MgSelection($map,$sel); 
      if($selection != ''){ 
        $layers = $selection->GetLayers(); 
        if(!$layers){ $layers = $map->GetLayers(); } 
      }else{ $layers = 0; } 
      $layer = null; 
      if($layers){ 
      for($i = 0; $i < $layers->GetCount(); $i++){ 
        if($layers->GetItem($i)->GetName() == "parcels"){ $layer = 
$layers->GetItem($i); } 
      } 
      $queryOptions = new MgFeatureQueryOptions(); 
      if($layer){ 
        $layerClassName = $layer->GetFeatureClassName(); 

        // Check the $selection object for the GenerateFilters method
        // If it exists, use it to generate the $selString, otherwise 
        // use the GenerateFilter method
        if($sel != ''){ 
          if(method_exists($selection,'GenerateFilters')){
            $filters =
$selection->GenerateFilters($layer,$layerClassName,$scnt);
            $selString = $filters->GetItem(0);
          }else{ $selString =
$selection->GenerateFilter($layer,$layerClassName); }
        } 

        $layerFeatureId = $layer->GetFeatureSourceId(); 
        $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); 
        $layerId = $layer->GetObjectId(); 
        $queryOptions->SetFilter($selString); 
        $featureReader = 
$featureService->SelectFeatures($layerFeatureResource,$layerClassName,$queryOptions); 
        $selTmp = ''; 
        for($pdx=0; $pdx<$featureReader->GetPropertyCount(); $pdx++){ 
          $pnm = $featureReader->GetPropertyName($pdx); 
          if($pnm == 'PARCEL_ID_'){ break; } 
          if($pnm == 'PARCELID'){ break; } 
          if($pnm == 'Key'){ break; } 
          $pnm = ""; 
        } 
        if($pnm != ""){ 
          while($featureReader->ReadNext()){ 
            $stg = $featureReader->GetString($pnm); 
            if($stg != ""){     $obj_keys .= "'" . $stg . "'"; } 
          } 
        } 
        $obj_keys = str_replace("''","','",$obj_keys); 
      } 
    } 
    return $obj_keys; 
  }else{ return ''; } 
} 

-- 
View this message in context: http://www.nabble.com/Selection-Issue-%28FeatureReader-only-grabbing-20-items%29-tp18570994p18612948.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list