queryUsingPoint problems

Doyon, Jean-Francois Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Fri Sep 8 14:13:35 EDT 2000


Hello,

I too seem to be having problems ... using the PHP/Mapscript, the querying
methods
don't seem to be returning an object (queryResultObj, I would expect) ... I
don't get any
errors from the query method (
$layername->queryusingpoint($point,MS_SINGLE,-1) )
either ... $point IS a pointObj with X and Y in the projection cooridnate
system (i.e. not
in pixels).

And so far, whether I query the map or the layer, the result is allways "0"
(the number zero).

The docs say the method queryUsingPoint should return void, is that right ?
Seems to me
it should return a queryResultObj ...

I'm stumped ... Anybody ?

J.F.

> ----------
> From: 	Sean O'Hagan[SMTP:seano at metavera.com]
> Reply To: 	Sean O'Hagan
> Sent: 	Wednesday, September 06, 2000 2:55 PM
> To: 	MapServer List
> Subject: 	queryUsingPoint problems
> 
> Hello:
> 
> I'm having some problems with queryUsingPoint. The 'numresults' and
> 'numquerylayers' members of the returned qryResultObj seem to be
> undefined.
> My print statements in the code below show no values. Is my syntax
> incorrect? Thanks very much in advance.
> 
> Sean.
> 
> 
> #!perl
> use mapscript;
> 
> # getShapesNear( map_file, x_coord, y_coord, layer_number, max_shapes )
> sub getShapesNear {
> 
>   my @shapes;
>   my $point = new pointObj();
>   my $qryResult;
>   my $mapfile   = new mapObj($_[0]);
>   $point->{x}   = $_[1];
>   $point->{y}   = $_[2];
>   my $layerNum  = $_[3];
>   my $numShapes = $_[4];
> 
>   $qryResult = $mapfile->queryUsingPoint($point, MS_MULTIPLE, -1);
>   $j = 0;
> 
> print "Number of shapes on all layers: $qryResult->{numresults}\n";
> print "Number of layers searched: $qryResult->{numquerylayers}\n";
> 
>   for (my $i=0; $i<$qryResult->{numresults}; $i++) {
>     my $shpResult = $qryResult->next();
>     if ($layerNum == $shpResult->{layer}) {
>       @shapes[$j++] = $shpResult->{shape};
>     }
>   }
>   $qryResult->{free};
>   return @shapes;
> }
> @closeStops = getShapesNear( 'mapfile.map', 923072.8083, 523859.9862, 2,
> 0 );
> print "RecNum: @closeStops[0]\n";
> exit;
> 
> 



More information about the mapserver-users mailing list