Closest Feature Query
Abe Gillespie
abe.gillespie at GMAIL.COM
Wed Jul 13 12:21:28 PDT 2005
Oh, great! That's not clear in the docs. And I was just finishing up
my own recursive query ... heh. :)
Thanks.
-Abe
On 7/13/05, Steve Lime <steve.lime at dnr.state.mn.us> wrote:
> I'm not sure the exact syntax but you basically:
>
> 1) load the mapfile (or create in memory)
> 2) create the query point
> 3) use the map or layer queryByPoint methods with MS_SINGLE as the query type (returns closest feature instead of all features)
> 4) process the result
>
> Again, you can search one layer or multiple layers. MapServer will search through multiple layers in reverse mapfile order. If nothing is found in the first then the second is searched and so on. Use layer tolerances to control fuzzy selection...
>
> You can easily do something like this with just the CGI and save the programming headache in many cases.
>
> Steve
>
> >>> Abe Gillespie <abe.gillespie at gmail.com> 07/13/05 10:43 AM >>>
> 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