[mapserver-users] get the closest feature in a point query

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Mon Dec 13 17:46:39 EST 2010


For mode=query (e.g. a standard point query) the closet feature is found. A layer's tolerance is used to select candidate features and then distances are computed for each candidate feature. If no feature is found in one layer then the process moves to the next layer. The computed distance doesn't persist across layers...

Does this make sense or are you seeing something different?

Steve

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Andy Colson
Sent: Thursday, December 09, 2010 11:17 AM
To: Mark Volz
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] get the closest feature in a point query

On 12/9/2010 11:07 AM, Mark Volz wrote:
> Hello,
>
> I know we can use tolerance/ toleranceusnitsto control the sensitivity
> forspatial queries. Is there a way tofurthercontrol queries by getting
> the nearest feature, or the first feature found?
>
> Thanks
>
> Mark Volz
>
> GIS Specialist
>
> Lyon County, MN
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

Not sure if this'll help, but I use PostGIS for that, here is the query 
I use to find the nearest road from a click point:


select roads, distance(the_geom, GeomFromText(point, -1)) as distance
from cadastralLine, ST_Buffer(GeomFromText(point, -1), 100) as g
where the_geom && g and roads is not null
order by distance
limit 1

point here is a text variable, like: POINT(1 100)

-Andy
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list