[mapguide-users] Problem with MgSelection's GetSelectedFeatures

Mauricio Villablanca mgvillablanca at yahoo.com
Thu Jul 23 03:46:13 EDT 2009


Instead of 
$featureReader = $selection->GetSelectedFeatures($layer, $className,
$boolS); 
use this

$strings = "featId = 1"; //the filter that matches the selected features
$queryOptions = new MgFeatureQueryOptions();
$queryOptions->SetFilter($strings);
$layerFeatureId = $layer->GetFeatureSourceId();
$layerFeatureResource = new MgResourceIdentifier($layerFeatureId);
$layerClassName = $layer->GetFeatureClassName();

$featureReader = $featureService->SelectFeatures($layerFeatureResource,
$layerClassName$queryOptions);



Tom Lazo / Stygy wrote:
> 
> Hi, 
> 
> Well, srry about my last post, quiet stupid...dun worry..i erased it.
> Ok, i'm using the MgSelection as it follows	
> 
>         include ("Common.php");
>         include('../../common/php/Utilities.php');
>         include('Utilities.php');
> 	
> 	$featureService =
> $siteConnection->CreateService(MgServiceType::FeatureService);
> 
>         $map = new MgMap();
>         $map->Open($resourceService, $mapName);
> 	
> 	$selection = new MgSelection($map);
> 	$selection->Open($resourceService,$mapName);
> 		
> 	$layers = $map->GetLayers();
> 	
> 	$layer = $layers->GetItem("LOTES"); // Ya tengo mi MgLayerBase
> 	$className = $layer->GetFeatureClassName();
> 	
> 	$layersS = $selection->GetLayers();
> 	
> 	$ind = $layersS->IndexOf($layer);
> 	echo $ind . " \n ";
> 	
> 	$boolS = true;
> 	
> 	$featureCount = $selection->GetSelectedFeaturesCount($layer,$className); 
> 	echo $featureCount . " \n ";
> 
> 	$featureReader =
> $selection->GetSelectedFeatures($layer,$className,$boolS); 
> 
> I have no problem with the GetSelectedFeaturesCount ( it gives me the
> correct number), my problem is the  GetSelectedFeatures function... my app
> crashes when i uncomment it. Could somebody tell me why ?
> 
> Thanks.
> 
> Tom 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Problem-with-MgSelection%27s-GetSelectedFeatures-tp3305494p3308054.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list