queryUsingPoint returning incorrect record number??
Stephen Lime
steve.lime at dnr.state.mn.us
Tue Sep 12 19:34:41 PDT 2000
Hi: MapServer/MapScript shape indexes start at 0 so that explains the "off by one" problem. The shape index is intended as a key to the xbase and shapes themselves and nothing more. As for that last point, don't know, could be lots of explanations. MapServer/MapScript use a circular buffer, that is, each candidate features distance from the search point is computed and compared to the search tolerance.
I certainly wouldn't expect 9 to match and one not to. Usually you see an all or nothing pattern. ArcExplorer could be wrong too, the MapScript id for the last point makes more sense given the previous 9.
Care to share the shapefile and script?
Steve
>>> "Sean O'Hagan" <seano at metavera.com> 09/12/00 15:13 PM >>>
Hello yet again :-)
I thought I'd verify that the set of points returned to me with
queryUsingPoint matched what I obtained visually using ArcExplorer. The
point sets returned by both MapScript and ArcExplorer were:
MScr ArcE
2797 2798
2799 2800
2801 2802
2802 2803
2803 2804
2804 2805
2806 2807
2807 2808
2809 2810
2811 2824
I thought perhaps there was a pattern, ie. mapscript was returning the
"correct record number minus one". In fact this is what happens when I
restrict the tolerance to only produce one point; instead of the correct
2804, I'm getting 2803. However, the last value of the table on the ArcE
side blows that theory out of the water.
Here's some code snippets:
Part of Map File:
<snip>
LAYER
NAME mylayer
TYPE point
TOLERANCEUNITS meters
TOLERANCE 100 #this generates one point, set to 1000 generates the ten
points shown above
STATUS default
DATA file_name
CLASS
SYMBOL 8
SIZE 8
COLOR 255 100 0
END
QUERY
TEMPLATE dummy
END
END
<snip>
My call to qUP:
<snip>
$qryResult = $mapfile->queryUsingPoint($point, 1, -1);
for (my $i=0; $i < $qryResult->{numresults}; $i++) {
my $shpResult = $qryResult->next();
$shapesref->[$i] = $shpResult->{shape};
}
<snip>
Metavera Solutions, Inc.
192 Spadina Ave., Suite 405
Toronto, ON
M5T 2C2
Tel: (416) 504-8351
Fax: (416) 364-2636
Email: seano at metavera.com
Fallback email: smohagan at yahoo.com
More information about the MapServer-users
mailing list