<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>
<body lang=HR link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Susan,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>If your column ID is type of</span><span lang=EN-AU
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> string</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> put the
filter value must be rounded with qoute marks.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>susan
Daniel<br>
<b>Sent:</b> Wednesday, May 06, 2009 7:04 AM<br>
<b>To:</b> MapGuide Users Mail List<br>
<b>Subject:</b> [mapguide-users] setting filter<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>hi all.....<br>
<br>
       Anyone plzz help me to set the filter.I am
having  a feature source with properties(pan_id,Name.,etc..).Now I
wanna  select the polygon  from the map  having pan_id=ID.<br>
The ID will be entered from the task pane. Here is my code:<br>
<br>
<b>I copied it from dev guide..Then what is this this"SHPGEOM" in
setspatialfilter<br clear=all>
</b><br>
<br>
<br>
<?php<br>
    include '../common/common.php';<br>
<br>
    $args = ($_SERVER['REQUEST_METHOD']=="GET")?
$_GET: $_POST;<br>
     <br>
    $sessionId = $args['SESSION'];<br>
    $mapName = $args['MAPNAME'];<br>
    $ID= $_GET['PanId'];<br>
     <br>
<br>
    try<br>
    {<br>
<br>
      // Initialize the Web Extensions and connect to
the Server using<br>
      // the Web Extensions session identifier stored
in PHP session state.<br>
<br>
      MgInitializeWebTier ($webconfigFilePath);<br>
<br>
      $userInfo = new
MgUserInformation($sessionId  );<br>
      $siteConnection = new MgSiteConnection();<br>
      $siteConnection->Open($userInfo);<br>
<br>
      $map = new MgMap($siteConnection);<br>
      $map->Open( $mapName  );<br>
<br>
      // Get the geometry for the boundaries of
District <br>
<br>
      $districtQuery = new MgFeatureQueryOptions();<br>
     <b>
$districtQuery->SetFilter("pan_id=$ID");</b><br>
<br>
      $layer = $map->GetLayers()->GetItem(0);<br>
      $featureReader =
$layer->SelectFeatures($districtQuery);<br>
      $featureReader->ReadNext();<br>
      $districtGeometryData = $featureReader-><br>
      GetGeometry('Data');<br>
<br>
      // Convert the AGF binary data to MgGeometry.<br>
<br>
      $agfReaderWriter = new MgAgfReaderWriter();<br>
      $districtGeometry = $agfReaderWriter->Read($districtGeometryData);<br>
<br>
      // Create a filter to select the desired
features. Combine<br>
      // a basic filter and a spatial filter.<br>
<br>
      $queryOptions = new MgFeatureQueryOptions();<br>
      $<b>queryOptions->SetFilter("pan_id=$ID");
<br>
      $queryOptions->SetSpatialFilter('SHPGEOM',
$districtGeometry, MgFeatureSpatialOperations::Inside);<br>
</b><br>
      // Get the features from the feature source,<br>
      // turn it into a selection, then save the
selection as XML.<br>
<br>
      $layer = $map->GetLayers()->GetItem(0);<br>
      $featureReader =
$layer->SelectFeatures($queryOptions);<br>
<br>
      $layer =
$map->GetLayers()->GetItem(0);       <br>
      $selection = new MgSelection($map);<br>
      $selection->AddFeatures($layer,
$featureReader, 0);<br>
      $selectionXml = $selection->ToXml();<br>
<br>
       <br>
    }<br>
    catch (MgException $e)<br>
    {<br>
      echo $e->GetMessage();<br>
      echo $e->GetDetails();<br>
    }<br>
    ?><br>
<br>
  </body><br>
<br>
  <script language="javascript"><br>
 <br>
<br>
    function OnPageLoad()<br>
    {<br>
      selectionXml = '<?php echo $selectionXml;
?>';<br>
      parent.parent.SetSelectionXML(selectionXml);<br>
    }<br>
<br>
  </script><br>
<br>
</body><br>
</html><br>
<br>
<br>
<br>
-- <br>
thanks&regards<br>
 susan<o:p></o:p></p>
</div>
</body>
</html>