querybypoint Postgis

Bertsch clemens.bertschler at GMAIL.COM
Fri May 12 18:39:29 EDT 2006


Hi list

I have a little problem with my application. I have several different
layers(shapefile) furthermore, I have points stored in a PostGIS database.
Every thing works fine except the querying of points in the database, it
shows me always a result but there seems to be nothing in the resultset, at
least the shapeindex of the result is always 1. With points from a shapefile
it works but not for points in PostGIS, i have to add something special?
Maybe the code is not correct, but remind with normal shape files it is
functioning very well.
Thanks anyway,

------------------------------------------------------------------
MAPFILE

LAYER 
		NAME fincas
		TYPE POINT
		CONNECTIONTYPE postgis
		CONNECTION "dbname=........"
		DATA "the_geom FROM (SELECT the_geom from mus where longitudecenter <> 0
AND NAME = 'USAR-0') AS myquery USING UNIQUE the_geom using SRID = -1"
		STATUS ON
		TOLERANCE 4
		METADATA
			"DESCRIPTION" "farms"
			"RESULT_FIELDS" "f_code" 
			"TABLE_NAME" "public.mus" # i need that?
		END
		
		CLASS
			NAME "farms"
			TEMPLATE "Dummy"
			STYLE
				SYMBOL "POINT"
				COLOR 192 192 192
				SIZE 8
			END
		END
	END
------------------------------------------------------------------
PHP code
$other_point->setXY($x,$y);  //x and y are longitude and latitude
$map->querybyPoint($other_point,MS_MULTIPLE,-1);
$layer = $map->getLayerByName('farms');
	echo("<br>".$layer->getNumResults()); // i get an result
$layer->open();
$selFields = explode(" ", $layer->getMetaData("RESULT_FIELDS"));
$oRes = $layer->getResult(0);

echo($oRes->tileindex." ".$oRes->shapeindex." ".$oRes->classindex); //
always -1 1 0
	if($layer->getNumResults() != 0){
		$oShape = $layer->getShape($oRes->tileindex,$oRes->shapeindex);
		$ID = $oShape->values['f_code'];
		$oShape->free(); //ERROR Call to a member function on a non-object
	}

--
View this message in context: http://www.nabble.com/querybypoint-Postgis-t1610695.html#a4366731
Sent from the Mapserver - User forum at Nabble.com.



More information about the mapserver-users mailing list