select objects on multiple layers

Willem Schwarte willem at giskit.nl
Tue Jun 6 09:53:11 EDT 2006


Hi ,

 

I now use this code to generate a link with xml to select objects found
on the layers in a map:

 

                        $filter = "CRE03 = '00000030UP-BBW' AND
(HYPERLINK = 's199' OR HYPERLINK = 's132')";

$opts = new MgFeatureQueryOptions();

                        $opts->SetFilter($filter);

                        

                        $layers = $map->GetLayers();

 

                        for ($i = 0; $i < $layers->GetCount(); $i++)

                        {

                                   $firstLoop = 1;

                                   $layer = $layers->GetItem($i);

            

                                    if ($layer)

                                   {

                                               $featureClassName =
$layer->GetFeatureClassName();

                                               $srcId = new
MgResourceIdentifier($layer->GetFeatureSourceId());

                                               $features =
$featureService->SelectFeatures($srcId, $featureClassName, $opts);

                                               $hasResult =
$features->ReadNext();                                        

                                               

                                               if($hasResult)

                                               {

                                                              $sel = new
MgSelection($map);

                                                              

                                                              do

                                                              {

 
$sel->AddFeatureIdInt32($layer, $featureClassName,
$features->GetInt32('FeatId'));

                                                              }
while($features->ReadNext());

 
$selText = StrEscape($sel->ToXml(), true);

 
?>

 
<a href="#" onClick="CellClicked('<?=$selText;?>');">Click to select
objects</a> 

 
<?

                                               }else

                                               {

 
echo "no results";

                                               }


                                   } // endif

                        } // next $i

 

 

Now I will e.g. get 2 links. What I really want to achieve is that 1 XML
string is created so if I click on the link, all objects on all layers
will be selected.

 

Is this at all possible?

 

Willem

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide_users/attachments/20060606/60a72c19/attachment.html


More information about the Mapguide_users mailing list