[mapguide-users] Petitions too slow?

Jose Manuel C G gis at mapas-sll.com
Thu Jun 1 10:57:14 EDT 2006


Here is the modified code in php, the basic is here, the rest you can
imagine...

<?php
    include 'appconstants.php';   //In this file I've included the code to
$siteConnection, $resourceService and $featureService.

	$matches = 0;
	
		$StrAddr = trim($_GET['StrAddr']);
		$NumVia = trim($_GET['HouseNumber']);
        if (strlen($owner) > 0){
			if (strlen($NumVia) > 0){
				$filter = "NOMBREVIA LIKE '" . $StrAddr . "' AND PRIMERNUM = " . $NumVia
. "";

				$featureResId = new MgResourceIdentifier("Library://<path to your
FSource>/Callejero.FeatureSource");
				$queryOptions = new MgFeatureQueryOptions();
				$queryOptions->SetFilter($filter);

				$geometryReaderWriter = new MgAgfReaderWriter();
		
				$featureReader = $featureService->SelectFeatures($featureResId,
"Callejero", $queryOptions); // Callejero is the name of the layer

				while ($featureReader->ReadNext()){
					$name = $featureReader->GetString('NOMBREVIA');
					$tipovia = $featureReader->GetString('TIPOVIA');
					$refcat = $featureReader->GetString('CRT');
	
					$byteReader = $featureReader->GetGeometry('Geometry');
	
					$geometry = $geometryReaderWriter->Read($byteReader);
					$point = $geometry->GetCentroid();
					$x = $point->GetCoordinate()->GetX();
					$y = $point->GetCoordinate()->GetY();
	
					echo "setArrayElement(' $tipovia $name, $NumVia ');";
					$matches++;
				}            
			}else{
			//  If the user only input Street Name 
				$filter = "NOMBREVIA LIKE '" . $StrAddr . "'";

				$featureResId = new MgResourceIdentifier("Library://<path to your
FSource>/Calles.FeatureSource");
				$queryOptions = new MgFeatureQueryOptions();
				$queryOptions->SetFilter($filter);

				$geometryReaderWriter = new MgAgfReaderWriter();
		
				$featureReader = $featureService->SelectFeatures($featureResId,
"Calles", $queryOptions); //Calles is the name of another layer

				while ($featureReader->ReadNext()){
					$idc = $featureReader->GetString('IDC');
					$tipovia = $featureReader->GetString('TIPOVIA');
					$name = $featureReader->GetString('NOMBREVIA');
					$escala = $featureReader->GetString('ESC');
	
					$byteReader = $featureReader->GetGeometry('Geometry');
	
					$geometry = $geometryReaderWriter->Read($byteReader);
					$point = $geometry->GetCentroid();
					$x = $point->GetCoordinate()->GetX();
					$y = $point->GetCoordinate()->GetY();
	
					echo "setArrayElement(' $tipovia $name ');";
					$matches++;
				}
			}
		$featureReader->Close();
        }else{
		// The user doesn't input a Street Name
		echo "traducir('Bsq03');"; // traducir is a function in javascript to
translate.
        }
		if ($matches == 0){
		echo "traducir('Bsq04');";
		}
?>
--
View this message in context: http://www.nabble.com/Petitions+too+slow--t1715911.html#a4663663
Sent from the OSGeo MapGuide forum at Nabble.com.





More information about the Mapguide-users mailing list