Brian: Via the CGI or can you use MapScript? The normal mode=query does this but only one layer at a time. Simple point queries make distance computations to find the closest feature within a search area. For example, you set the tolerance for a layer (say 5 miles for schools) and then MapServer finds the closest school to the XY point. If no schools are within that tolerance then the query fails. If the XY is in a polygon the distance is zero and the search returns quickly.
You also have other options. With MapScript, of course, you could loop through your candidate layers and do a simple point query. Your client software could also issue multiple simple mode=query requests, one for each layer, using AJAX and you could build a result set that way. Steve >>> "Fischer, Brian" <[EMAIL PROTECTED]> 11/01/07 3:57 PM >>> MapServer users, I am curious to hear if anyone knows if it is possible to implement a nearest search with mapscript. For example I want to take an xy point that a user clicked on the map and find the nearest feature in many different layers to that point. For example nearest park, library, school, etc. It is also possible the point could be contained with in a polygon. Is there a Geos function in mapscript to do this? I haven't seen this done before with mapserver, but thought I would ask anyway. I know I could do it with PostGIS, but I'm trying to get away without making that a requirement for my application. Thanks for any feedback you can give me. -Brian
