Closest Feature Query

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Wed Jul 13 12:57:36 EDT 2005


Abe Gillespie wrote:
> Are you sure this can be done?  I'm not finding this specific type of
> query in the docs.  There is queryByPoint - which seems to be the
> *closest* to what I'm looking for - but this is a classic buffer
> query.  I'm looking for sorta the reverse of a buffer query.
> 
> Buffer - Start point known / distance known -> returns all features
> w/i the distance from the start point.

You can get this by requesting multiple results instead of just on 
result. Set mode=MS_MULTIPLE.

-Steve W.

> Closest Feature - Start point known / distance unknown -> returns one
> feature that's closer than all the other features to the start point.
> 
> -Abe
> 
> On 7/13/05, Abe Gillespie <abe.gillespie at gmail.com> wrote:
> 
>>Yes, "as the crow flies" is fine; no routing needed.  How is this done
>>in PHP MapScript?
>>
>>Thanks.
>>-Abe
>>
>>On 7/13/05, Steve Lime <steve.lime at dnr.state.mn.us> wrote:
>>
>>>The normal MapServer query will do this but only using "as the crow flies" distances. You use the layer tolerance to set a maximum distance. If you need to need to compute distances along an established route then that's a different story and is not something MapServer can do out of the box.
>>>
>>>Steve
>>>
>>>
>>>>>>Abe Gillespie <abe.gillespie at GMAIL.COM> 07/12/05 10:05 PM >>>
>>>
>>>Is there an easy way to query for the closest feature to another
>>>feature.  Take for example the classic "closest ATM" query.  I know
>>>where I'm at (an address point or building feature) and want the
>>>closest ATM.  Can I avoid having to create a line to each ATM point
>>>from the starting point, comparing the length of each line, and
>>>keeping the shortest?
>>>
>>>Thanks.
>>>-Abe
>>>
>>
> 



More information about the mapserver-users mailing list