queryUsingPoint problems
Sean O'Hagan
seano at metavera.com
Wed Sep 6 11:55:58 PDT 2000
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