[mapguide-users] Layer doesn't get selected in Ajax viewer
shraddha khandke
shraddha.khandke at gmail.com
Wed Jan 22 21:23:23 PST 2014
I have written the following code for selecting the taxparcel in specific
date range and and price range I am able select the attrubute but not able
to select the parcel.Anybody knows whats the problem?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Viewer Sample Application - Query Parcels</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 rel="stylesheet" href="../styles/globalStyles.css" />
</head>
<body class="AppFrame">
Search By Date
<hr/>
<?php
require_once '../common/common.php';
$args = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST : $_GET;
$sessionId = $args['SESSION'];
$mapName = $args['MAPNAME'];
$ppin= $_POST['PPIN'];
$datepickerFr =$_POST['datepickerFrom'];
$datepickerT =$_POST['datepickerTo'];
list($monthFr, $dayFr, $yearFr) = split('[/.-]', $datepickerFr);
list($monthTo, $dayTo, $yearTo) = split('[/.-]', $datepickerT);
$salePrFr=$_POST['SALEPRFR'];
$salePrTo=$_POST['SALEPRTO'];
$dateFrom = $yearFr.$monthFr.$dayFr;
$dateTo = $yearTo.$monthTo.$dayTo;
try
{
// Initialize the Web Extensions and connect to
// the Server using the Web Extensions session
// identifier stored in PHP session state.
MgInitializeWebTier ($webconfigFilePath);
$userInfo = new MgUserInformation($sessionId);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($userInfo);
$resourceService=$siteConnection->CreateService(MgServiceType::ResourceService);
$featureService=$siteConnection->CreateService(MgServiceType::FeatureService);
$map = new MgMap();
$map->Open($resourceService,$mapName);
$districtQuery = new MgFeatureQueryOptions();
$districtQuery->SetFilter("DATE_CHANG >= $yearFr AND DATE_CHANG <=
$yearTo AND LAND_USE_C >$salePrFr AND LAND_USE_C <$salePrTo ");
$districtResId=new
MgResourceIdentifier("Library://LincolnMS/Data/TAXPARCEL.FeatureSource");
$featureReader = $featureService->SelectFeatures($districtResId,
"TAXPARCEL",$districtQuery);
$layer = $map->GetLayers()->GetItem('TAXPARCEL');
$selection = new MgSelection($map);
$selection->AddFeatures($layer, $featureReader, 0);
$selectionXml = $selection->ToXml();
$id=1;
while ($featureReader->ReadNext())
{
if($id==1)
{
echo '
';
echo '';
echo "
";
echo ' Sale Date';
echo ' Owner';
echo "";
echo "";
}
if($id&1)
{
echo '
';
}
else
{
echo '
';
}
$yearVal = $featureReader->GetDouble('DATE_CHANG');//Year
$yearVal = $featureReader->GetDouble('DATE_CHANG');//Year
$monVal = $featureReader->GetDouble('DATE_CHA_1');//month
$dayVal= $featureReader->GetDouble('DATE_CHA_2');//day
if($monVal<10)
$monVal="0".$monVal;
if($dayVal<10)
$dayVal="0".$dayVal;
$saleDate=$yearVal.$monVal.$dayVal;
$name = $featureReader->GetString('NAME');
if(($saleDate>$dateFrom)&&($saleDate<$dateTo))
{
echo " ". $yearVal."-".$monVal."-".$dayVal. " ".$name. '';
}
$id++;
echo "";
}
if($id==1)
{
echo "Record Not Found";
}
echo "
";
}
catch (MgException $e)
{
echo $e->GetMessage();
echo $e->GetDetails();
}
catch (Exception $e)
{
echo $e->getMessage();
}
?>
</body>
</html>
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Layer-doesn-t-get-selected-in-Ajax-viewer-tp5099556.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list