Question about querybypoint
Steve Lime
Steve.Lime at DNR.STATE.MN.US
Thu May 18 20:42:53 PDT 2006
Generally a query by point is faster since you compute distances as opposed to detecting intersections when the simple bbox tests (that both methods use) are inconclusive.
Only the point query can give you a single result. By rect or shape give you all that intersect the selection feature.
Steve
>>> "Frederico Lucca" <fredlucca at gmail.com> 05/18/06 6:25 PM >>>
Steve,
Thank you for the explanation.
I speed up my queries removing from the layer the features without
information and using MS_SINGLE, because I just need the closest feature.
Another question if you have time.
querybypoint is faster than querybyrect?
Thanks again,
Fred
On 5/18/06, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
>
> Layer tolerances are used to set a spatial filter that is used to identify
> target
> features. Those features are then processed to make sure they meet the
> target criterea. For example, if you query a layer with a tolerance of 100
> meters
> then MapServer constructs a bbox 200 meters on a side centered on the
> query point and uses that to find candidate features.
>
> There is no predictable relationship between tolerance and query speed
> although
> in practice smaller tolerances should produce faster queries since there
> are likely
> to be less candidate features to process.
>
> MS_SINGLE will find the closest feature in a point query situation
> (potentially
> across multiple layers). MS_MULTIPLE will find all features that meet the
> tolerance
> settings. MS_SINGLE can be much faster in certain situations, especially
> when
> querying a polygon layer since being inside the polygon gives you a
> distance
> of 0 and stops the query process. When querying points and lines where a
> perfect 0 distance is unlikely you end up having to process all candidate
> features
> to make sure you identify the closest one.
>
> Querybyrect is faster than querybyshape.
>
> Steve
>
> >>> Frederico Lucca <fredlucca at GMAIL.COM> 5/18/2006 8:40:05 AM >>>
> Hello list,
>
> I'm querying a layer by point, using tolerance in meters because I need to
> find some street in a point using Decimal Degrees and a range in meters.
>
> Something like:
>
> layer.setSizeunits(mapscript.MS_METERS);
> layer.setToleranceunits(mapscript.MS_METERS);
> layer.setTolerance(radius);
>
> layer.queryByPoint(map, point, mapscript.MS_SINGLE, -1)
>
> Comparing two radius, 100 and 50 meters, I think 50 is twice faster than
> 100, is this true?
>
> What's the difference between MS_SINGLE and MS_MULTIPLE.
> MS_SINGLE find one, and only one feature??? MS_SINGLE is much faster than
> MS_MULTIPLE?
> Supousing that I need to return the nearest street name and some streets
> don't have name, is better to querybypoint with 50 meters and if the
> street
> don't have a name find again, with 100 meters? Or find MS_MULTIPLE with
> 100
> meters?
> querybyrect or querybyshape are faster?
>
> I need the fastest result because i need to query in 10 layers very
> quickly.
>
> Thanks in advance.
>
> Fred
>
> --
> "Everything under the sun is in tune
> But the sun is eclipsed by the moon"
>
--
"Everything under the sun is in tune
But the sun is eclipsed by the moon"
More information about the MapServer-users
mailing list