queryByAttributes - speed

Bart van den Eijnden (OSGIS) bartvde at OSGIS.NL
Tue Feb 27 03:39:29 PST 2007


Hi,

I don't believe the Mapinfo attribute indexes are used by Mapserver/OGR.
This is not implemented.

So if you need performance, store your data in e.g. PostGIS instead if
possible.

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: Jeppe Lund Andersen <JXA at COWI.DK>
Naar: MAPSERVER-USERS at LISTS.UMN.EDU <MAPSERVER-USERS at LISTS.UMN.EDU>
Onderwerp: [UMN_MAPSERVER-USERS] queryByAttributes - speed
Datum: 27/02/07 09:34

> Hello all
> 
> Iam running php mapscript on a windows 2003 server and when Iam using
> queryByAttributes, but it take some time to perform the search.
> It takes between 7-8 sek for this linie
> 
> $Qry = @$Layer->queryByAttributes($ID_navn, '(' . $Search_Str .')',
> $ResultType);
> 
> The file iam using is a mapinfo file which has cadastral information.
> there are 156612 records in the file and the coln iam searching in has
> been index via mapifno.
> the field is a text field
> 
> Am I doing something wrong ?
> 
> Jeppe
> 
> here is the funktion that load the map and perform the search
> 
> function FindExtendForMatrikel()
> {
> 	global $GISREF_LAYER_NAME, $MAP_PATH_NAME, $MAP_FILE_NAME,
> $MATRIKEL_ID_NAME;;
> 	global $xmin, $ymin, $xmax, $ymax;
> 	global $MATRIKEL_LAYER_NAME, $starttid, $kort;
> 	$Shape_matr = array();
> 	
> 	$Result = mssql_query ("select * from kort WHERE name = '".
> $MATRIKEL_LAYER_NAME . "'");
> 	while ($row = mssql_fetch_array($Result)) 
> 	{
> 		$Map = ms_newMapObj($MAP_FILE_NAME);
> 		$Layer = ms_newLayerObj($Map);
> 		$Layer->set('name', "MatrikelSearchLayer");
> 		$Layer->set("connection", $row['MS_CONNECTION']);
> 		$Layer->set("connectiontype", MS_OGR);
> 		$Layer->set('status', MS_OFF);
> 		$Layer->set('type', MS_LAYER_POLYGON);
> 		$Layer->setProjection($row['MS_PROJECTION']);
> 		$Class = ms_newClassObj($Layer);
> 		$Class->set('name', "Matrikler");
> 		$Class->set('template', 'void');
> 	}
> 	
> 	foreach ($kort->objekter as $value) 
> 	{
> 		if ($value->ObjType() == "Matrikel") 
> 		{
> 	    
> 			$ID_value = $value->id;
> 			$Layer =
> $Map->getLayerByName("MatrikelSearchLayer");
> 			//$ID_value = "78065110g";
> 			$ID_navn = $MATRIKEL_ID_NAME;
> 			$ResultType = MS_MULTIPLE;
> 			
> 			$Search_Str = "";
> 			$matr_array = split(',', $ID_value);
> 			  
> 			foreach ($matr_array as $matr) 
> 			{
> 			  	if ($Search_Str != "") {
> 					$Search_Str .= " OR ";
> 				}
> 				$Search_Str .= " '[$ID_navn]' = '$matr'
> ";
> 			}
> 			
> 			$Qry = @$Layer->queryByAttributes($ID_navn, '('
> .. $Search_Str .')', $ResultType);
> 			$QryRes = $Layer->getNumResults();
> 			if ($QryRes == 0 ) { $kort->matrikelsogning =
> NULL;}
> 			
> 			for ($I = 0; $I < $QryRes; $I++) 
> 			{
> 			  	$Res = $Layer->getResult($I);
> 			 	$Layer->open();
> 			    	$Shape_matr[] =
> $Layer->getShape($Res->tileindex, $Res->shapeindex);
> 				$Layer->close();
> 				
> 			}
> 		}
> 	}
> 	
> }
> 
> 



More information about the MapServer-users mailing list