Hi, iam writing the code for parcel selection ... i got the $selectxml is null reference.the code seemed to be right... can anybody tell me what is the problem??????
my code is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <script language="javascript"> function Zoom1(sel) { var seltext=sel; parent.parent.mapFrame.SetSelectionXML(seltext); } </script> <?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(); $map->Open($resourceService, 'map'); $layers = $map->GetLayers(); $count = $layers->GetCount(); for ($i = 0; $i < $count; $i++) { $layer = $layers->GetItem($i); } $layerClassName = $layer->GetFeatureClassName(); $selection = new MgSelection($map); $FeatureResId = new MgResourceIdentifier("Library://data/resource.FeatureSource"); $queryOptions = new MgFeatureQueryOptions(); $val="PARCEL"; $val1="44142300003000"; $query=$val . "=" . $val1; $queryOptions->SetFilter($query); $featureReader = $layer->SelectFeatures($queryOptions); $selection->AddFeatures($layer, $featureReader, 0); $selectXml = $selection->ToXml(); $selection->Save($resourceService, 'map'); echo $selectXml; } 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"> </head> <body> <input type="button" name="button" value="Click" size="10" onclick="Zoom1(<?php echo $selectXml;?>)"> </body> </html> -- View this message in context: http://n2.nabble.com/Help-Me-tp4715106p4715106.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapguide-users
