[mapguide-users] Feature Set Empty
padmini godavarthi
godavarthi.padmini at gmail.com
Mon Mar 22 02:15:40 EDT 2010
Hi,
iam trying to do zoom+selection features on map.while applying query i got
feature set is empty
i think i have applied the query correctly.plz tell me the solution....
<?php
try
{
include 'utilityfunctions.php';
$webExtensionsDirectory = 'C:\Program Files\OSGeo\MapGuide\Web\\';
$MapGuideServerDirectory = 'C:\Program Files\OSGeo\MapGuide\Server\\';
$viewerFilesDirectory = $webExtensionsDirectory . 'www\viewerfiles\\';
$schemaDirectory = $MapGuideServerDirectory . 'Schema\\';
$webconfigDirectory = $webExtensionsDirectory . 'www\\';
$webconfigFilePath = $webconfigDirectory . 'webconfig.ini';
$args = ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST : $_GET;
$sessionId = $args['SESSION'];
echo $sessionId;
MgInitializeWebTier($webconfigFilePath);
$siteConnection = new MgSiteConnection();
$userinfo = new MgUserInformation($sessionId);
$siteConnection->Open($userinfo);
$resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
$featureService =
$siteConnection->CreateService(MgServiceType::FeatureService);
$map = new MgMap($siteConnection);
$map->Open('map');
$layers = $map->GetLayers();
$count = $layers->GetCount();
for ($i = 0; $i < $count; $i++)
{
$layer = $layers->GetItem($i);
}
$layerClassName1 = $layer->GetFeatureClassName();
$FeatureResId = new
MgResourceIdentifier("Library://data/resource.FeatureSource");
$queryOptions = new MgFeatureQueryOptions();
$val="PARCEL";
$val1="17330100001001";
$query=$val . "=" . $val1;
$queryOptions->SetFilter($query);
$layer=$map->GetLayers()->GetItem('property');
$featureReader = $layer->SelectFeatures($queryOptions);
$featureAgfGeometry =
$featureReader->GetGeometry('Geometry');
$agfReaderWriter = new MgAgfReaderWriter();
$featureGeometry =
$agfReaderWriter->Read($featureAgfGeometry);
$centroid = $featureGeometry->GetCentroid();
$mapCenterX = $centroid->GetCoordinate()->GetX();
$mapCenterY = $centroid->GetCoordinate()->GetY();
$selection = new MgSelection($map);
$selection->AddFeatures($layer, $featureReader,1);
$selectionXml = $selection->ToXml();
}
catch (MgException $e)
{
echo "<p><strong>Error:</strong> ";
echo $e->GetDetails();
echo "</p>";
}
?>
<html>
<head>
<title>Zoom Feature</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<link href="../styles/globalStyles.css" rel="stylesheet"
type="text/css">
<link href="../styles/otherStyles.css" rel="stylesheet" type="text/css">
<script language="javascript">
function Zoom1(x,y) {
var xval=x;
var yval=y;
selectionXml = '<?php echo $selectionXml;?>';
parent.parent.mapFrame.ZoomToView(xval, yval,
1000, true);
parent.parent.mapFrame.SetSelectionXML(selectionXml);
}
</script>
</head>
<body>
<input type="text" name="id" size="15">
<input type="button" name="button" value="Click" size="10"
onclick="Zoom1(<?php echo $mapCenterX;?>,<?php echo $mapCenterY;?>)">
</body>
</html>
regards,
Padmini G.
--
View this message in context: http://n2.nabble.com/Feature-Set-Empty-tp4776440p4776440.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list