queryByPoint accuracy/confusion
Tim Norris
tibben at OCF.BERKELEY.EDU
Thu Oct 13 14:31:32 PDT 2005
I am trying to query all point objects in a layer within a certain radius.
The layer is a dynamically loaded OGR (MapInfo) point layer in which I set
the 'toleranceunits' to MS_MILES and the 'tolerance' to my specific radius.
Then I simply run a $lyr_myLayer->queryByPoint($point,MS_MULTIPLE,0) and get
the count of the results $lyr_myLayer->getNumResults (all in PHP MapScript).
I am having trouble getting correct queryByPoint results. For some reason
the radius seems to be smaller than it should. I have even drawn the query
and then manually checked the query radius on a paper map (it is small).
After a search through the list archives I could not find any similar
problems . . .
[I have also tried $lyr_myLayer->queryByPoint($point,MS_MULTIPLE,$radius)
and I have also tried using meters and simply converting the miles radius to
meters - all the same results]
Perhaps I am not using the queryByPoint method correctly? Is there something
extra I should know about the 'tolerance' parameter in the layer???
My map projection is:
PROJECTION
"proj=merc" # Mercator
"lat_0=0" # latitude of natural origin
"lon_0=0" # longitude of natural origin (central longitude)
"x_0=0" # false easting in meters
"y_0=0" # false northing in meters
END
and all the MapInfo data is stored in a Lat/Long projection - would this
configuration cause an error????
Do I need to draw the layer before performing the query???? (I tried this on
one layer and there was no noticable difference).
One solution I have thought of is to manually create a layer with the
correct circles to use for the radius queries, but this seems clumsy and
hard to change in the future (for dynamic queries) - or perhaps create a
circle feature with the correct radius and use queryByShape or
queryByFeatures . . .
any help would be greatly appreciated
thanks
tim
tibben at ocf.berkeley.edu
p.s. as an aside, I can use my radius as (with toleranceunits as meters OR
miles):
$int_queryRadius += $int_queryRadius/4.3
and I get approximately the correct results - but this is really odd!! I
must be doing something incorrectly . . .
More information about the MapServer-users
mailing list