[mapguide-users] Highlighting selected features

Langen, Gido Gido.Langen at NRCan-RNCan.gc.ca
Tue Oct 27 16:49:48 EDT 2009


I want to highlight selected features.  I have pretty much copied the
code from the documentation.  But it doesn't work.  Below is the code.
Aside from not highlighting the selected feature, I do not understand
why the line    "<br>XML: <? echo $selectionXML; ?>"  in the code does
not print the XML block that I would expect.  At appears to me that the
"$selection->ToXML"   request doesn't create output.  

Can anybody help?
Gido




<?
include '../mapviewerphp/common.php';
include '../mapviewerphp/constants.php';
$configFilePath = '../webconfig.ini';
 
MgInitializeWebTier($configFilePath);

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

$sessionId = $args['SESSION'];
$mapName = $args['MAPNAME'];

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

<html>
<head> <title> TEST </title> </head>

<body onLoad="OnPageLoad">

<?
$map = new MgMap($siteConnection);
$map->Open($mapName);
$layer = $map->GetLayers()->GetItem('peguis');
$layerName = $layer->GetName();
$parcelQuery = new MgFeatureQueryOptions();
$parcelQuery->SetFilter("PIN = 1092213");
$featureReader = $layer->SelectFeatures($parcelQuery);
$featureReader->ReadNext();
$attVal = $featureReader->GetString("PARCELDESI");
$selection = new MgSelection($map);
$selection->AddFeatures($layer, $featureReader, 0);
$selectionXML = $selection->ToXml;
?>

<br>Test: <? echo $attVal; ?> 
<br>XML: <? echo $selectionXML; ?>
</body>

<script language="javascript" type="text/javascript">
  function OnPageLoad() {
    selXML = '<? echo $selectionXML; ?>
    parent.parent.mapFrame.SetSelectionXML(selXML);
  }
</script>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20091027/5d6b60d0/attachment.html


More information about the mapguide-users mailing list