Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LAYER SELECTION

1 REPLY 1
Reply
Message 1 of 2
Trape
569 Views, 1 Reply

LAYER SELECTION

GOOD DAY, I AM WITH PROBLEMS WITH LAYER SELECTION. IT WOULD LIKE TO KNOW IF SOMEBODY KNOWS WHAT IT CAN BE, WHERE IS THE ERRO.SEGUE THE CODE BELOW:

 

 <!-- body class="AppFrame" onLoad="OnPageLoad()" -->
 <?php
    include 'common2.php';
    include 'chamando_mapa.php';
   

    $args = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST : $_GET;
    $sessionId = $args['SESSION'];
    $mapName = $args['MAPNAME'];

    try
    {
      MgInitializeWebTier ($configFilePath);

      $userInfo = new MgUserInformation($sessionId);
      $siteConnection = new MgSiteConnection();
      $siteConnection->Open($userInfo);

      $map = new MgMap($siteConnection);
      $map->Open($mapName);

 
     $queryOptions = new MgFeatureQueryOptions();
     $queryOptions->SetFilter("DEN_ATU = 'FRANCISCO REBOLO R'");
     $layer = $map->GetLayers()->GetItem('eixos');
     $featureReader = $layer->SelectFeatures($queryOptions);
     $layer = $map->GetLayers()->GetItem('eixos');
   
     $selection = new MgSelection($map);
     $selection->AddFeatures($layer, $featureReader, 0);
     $selectionXml = $selection->ToXml();


}
catch (MgException $e)
{
echo $e->GetMessage();
echo $e->GetDetails();
}
   
    ?>
     <script language="javascript">
    
    function OnPageLoad()
   {

	var selectionXml = '<?php echo $selectionXml; ?>';
	xxx.mapFrame.SetSelectionXML(selectionXml);
	xxx.ExecuteMapAction(10);
   }
    </script>
    <body>
	<input type="button" name="ddd" value="" onclick="OnPageLoad();" />
	<br/>
<iframe style="width:800px;height:600px" id="xxx" name="xxx" src="/mapguide2010/mapviewerphp/ajaxviewer.php?SESSION=<?php echo $sessionId; ?>&WEBLAYOUT=<?php echo $homologLayout; ?>"> </iframe>
 

 

WHEN CLICO IN THE BUTTON IT APPEARS WITH 01 FEATURE SELECTED, BUT HE IS NOT NOTHING SELECTED, THEREFORE IN THE PROPERTIES IT DOES NOT APPEAR NOTHING.
PLEASE WHO WILL BE ABLE TO HELP IS THANKFUL ME IMMENSELY.
RATEFUL
CARLA TRAPÉ

1 REPLY 1
Message 2 of 2
jorgeolimpia
in reply to: Trape

Hi Carla.

 

If you're using Map Guide Enterprise 2010, look at Dev Guide manual, between pages 53 - 55. There's an example of how to select a feature. You can find it at %programfiles%\Autodesk\MapGuideEnterprise2010\WebServerExtensions\Help.

I think you can find the same file (DevGuide.pdf) if you're using another MapGuide's version.

You're getting the layer but you're not reading it. Check the method ReadNext().

 

Any doubts please let us know.

 

Regards,

 

 

Jorge Olimpia

Brazil

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report