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<br>