<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>&nbsp;</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>&nbsp;</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>&nbsp;</o:p></p>

<p class=MsoNormal>hi all.....<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Anyone plzz help me to set the filter.I am
having&nbsp; a feature source with properties(pan_id,Name.,etc..).Now I
wanna&nbsp; select the polygon&nbsp; from the map&nbsp; 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&quot;SHPGEOM&quot; in
setspatialfilter<br clear=all>
</b><br>
<br>
<br>
&lt;?php<br>
&nbsp;&nbsp;&nbsp; include '../common/common.php';<br>
<br>
&nbsp;&nbsp;&nbsp; $args = ($_SERVER['REQUEST_METHOD']==&quot;GET&quot;)?
$_GET: $_POST;<br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; $sessionId = $args['SESSION'];<br>
&nbsp;&nbsp;&nbsp; $mapName = $args['MAPNAME'];<br>
&nbsp;&nbsp;&nbsp; $ID= $_GET['PanId'];<br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>
<br>
&nbsp;&nbsp;&nbsp; try<br>
&nbsp;&nbsp;&nbsp; {<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Initialize the Web Extensions and connect to
the Server using<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // the Web Extensions session identifier stored
in PHP session state.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MgInitializeWebTier ($webconfigFilePath);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $userInfo = new
MgUserInformation($sessionId&nbsp; );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $siteConnection = new MgSiteConnection();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $siteConnection-&gt;Open($userInfo);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $map = new MgMap($siteConnection);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $map-&gt;Open( $mapName&nbsp; );<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the geometry for the boundaries of
District <br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $districtQuery = new MgFeatureQueryOptions();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>
$districtQuery-&gt;SetFilter(&quot;pan_id=$ID&quot;);</b><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layer = $map-&gt;GetLayers()-&gt;GetItem(0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $featureReader =
$layer-&gt;SelectFeatures($districtQuery);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $featureReader-&gt;ReadNext();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $districtGeometryData = $featureReader-&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetGeometry('Data');<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Convert the AGF binary data to MgGeometry.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $agfReaderWriter = new MgAgfReaderWriter();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $districtGeometry = $agfReaderWriter-&gt;Read($districtGeometryData);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create a filter to select the desired
features. Combine<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // a basic filter and a spatial filter.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $queryOptions = new MgFeatureQueryOptions();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $<b>queryOptions-&gt;SetFilter(&quot;pan_id=$ID&quot;);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $queryOptions-&gt;SetSpatialFilter('SHPGEOM',
$districtGeometry, MgFeatureSpatialOperations::Inside);<br>
</b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the features from the feature source,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // turn it into a selection, then save the
selection as XML.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layer = $map-&gt;GetLayers()-&gt;GetItem(0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $featureReader =
$layer-&gt;SelectFeatures($queryOptions);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layer =
$map-&gt;GetLayers()-&gt;GetItem(0);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $selection = new MgSelection($map);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $selection-&gt;AddFeatures($layer,
$featureReader, 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $selectionXml = $selection-&gt;ToXml();<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch (MgException $e)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo $e-&gt;GetMessage();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo $e-&gt;GetDetails();<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; ?&gt;<br>
<br>
&nbsp; &lt;/body&gt;<br>
<br>
&nbsp; &lt;script language=&quot;javascript&quot;&gt;<br>
&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp; function OnPageLoad()<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selectionXml = '&lt;?php echo $selectionXml;
?&gt;';<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.parent.SetSelectionXML(selectionXml);<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp; &lt;/script&gt;<br>
<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
<br>
<br>
<br>
-- <br>
thanks&amp;regards<br>
&nbsp;susan<o:p></o:p></p>

</div>

</body>

</html>