PHP/MapScript msQueryByPoint

DjwStone D.Stone at ED.AC.UK
Wed May 10 04:55:57 PDT 2006


Didrik Pinte wrote:
> 
> Le mercredi 10 mai 2006 à 02:21 -0700, DjwStone a écrit :
>> Thanks for the guidelines, guys. I'll need to play around a bit with this
>> since the PHP interface seems slightly different; also not sure how
>> PostGIS
>> differs from shapefile. Will post findings.
>> 
>> Dave
> 
> The code i've posted run only on PostGIS layers. The code is layer type
> independant  ;-)
> 
> What version are your running ? I'm having strange problems with the
> posted code on the 4.8 version but it works perfectly with 4.4.
> 
> Didrik
> 
> 
Sorry, don't know which version, but suspect it's 4.8.1.

I think the PHP interface is maybe where the difference lies. There is no
getResults() method documented, but the getResult() method for the layer
seems roughly equivalent. It gives you back a ResultCacheMemberObj, but
currently I don't see how to refer to its documented members (shapeindex,
tileindex, and classindex).  The code (snippet) I've developed so far looks
like this:

$i = $my_layer->queryByPoint($geo_point, $qmode, 0);
if ( $i == MS_SUCCESS ) {
	// assume qmode is MS_SINGLE for now ***
	$numHits = $my_layer->getNumResults(); // returns 1
	echo "No. of results = " . $numHits . "<BR>";
        $rCMObj = $my_layer->getResult(0);
	$my_layer->open();
	$my_shape = ms_newShapeObj("MS_SHAPE_POINT"); // ? needed ?
	$my_shape = $my_layer->getShape(-1, rCMObj->shapeindex);

The final line gives:
"Parse error: parse error, unexpected T_OBJECT_OPERATOR in
/var/www/html/saints/data/parish/phpex2.php on line 96"

I'm pretty sure it's the 'rCMObj->shapeindex' that's the problem, but
looking at the ResultCacheMemberObj definition in the 'PHP/MapScript Class
Reference', I don't see what's wrong. Any ideas?

TIA,

Dave

--
View this message in context: http://www.nabble.com/PHP-MapScript-msQueryByPoint-t1583615.html#a4317914
Sent from the Mapserver - User forum at Nabble.com.



More information about the MapServer-users mailing list