nearest feature

Bart van den Eijnden BEN at SYNCERA-ITSOLUTIONS.NL
Thu Aug 11 05:26:57 EDT 2005


You could try with a DWithin Filter, specifying a search distance, and then specifying maxfeatures = 1 in the request. I don't know if Mapserver does any weighting though with respect to distance, or if it just returns you the first feature it finds ..... you have to check that out. I suspect it just returns the first feature it finds. If that's the case I can't think of any other way to do this.

See for a Dwithin example:
http://mapserver.gis.umn.edu/doc46/filter-encoding-howto.html

Best regards,
Bart

Bart van den Eijnden
Syncera IT Solutions
Postbus 270
2600 AG  DELFT

tel.nr.: 015-7512436
email: BEN at Syncera-ITSolutions.nl

>>> Miguel Gonçalves <mgoncalves at DSI.UMINHO.PT> 08/11/05 11:22am >>>
Hi,

I am using MapServer in order to build a local-based context application.
I use a mapfile with several layers ansd I use a WFS request to get the
geographical information  related to a given point.
Normally I use a request of this type:
http://mapserv.exe?MAP=mymap.map& 
                             SERVICE=wfs&
                             VERSION=1.0.0&
                             REQUEST=getFeature&
                             TYPENAME={all the layers}&
                             BBOX=-8.418000,41.539600,-8.418000,41.539600

My problem is when the point that I pass in the BBOX does not coincides
geographically with any geographic feature in my map.
In those cases, is it possible, for each layer, to get the nearest feature?
You see what I mean? If I pass the point (x,y) in the BBOX and the
nearest feature to (x,y), in a given  layer, is  located  in (a,b),
is there any type of interface that gives (a,b) as result?



More information about the mapserver-users mailing list