ruan.tong ha scritto:
 Can any one help me?  Thanks a lot.
 ??2008-11-17??"ruan.tong" <[EMAIL PROTECTED]> ??????

hi,
      I want to cacluate the KNN (K-nearest neighor). I look for WFS
    filter document ,and it seems there are no such operators. Thus it
    may not be in geoserver, what should I do, should I implement it
    myself? if so, how?

You mean this?
http://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm

There is no way you can do such a thing with WFS, it's just beyond its
scope. WFS lives by these two limitations (among the others):
- it just returns xml element that comply with the schema of the feature
  type queried. To make a parallel with SQL, it's like doing a select in
  which you can just choose which attributes to output, but you cannot
  use expressions, aggregations, and so on. Actually it's even worse,
  since if the schema says an attribute must be there you'll get it
  in the output no matter if you asked for it or not
- filtering works on a feature per feature basis, each feature gets
  evaluated by the filters in total isolation, you cannot do the
  self join needed to do a nearest neighbour operation. Put in other
  terms, a WFS filter can only see one feature at a time, never sees
  the whole collection

What you're asking for is the domain of another OGC specification,
namely WPS (Web Processing Service) which is totally hands free and
can do basically what it wants with the input data, including performing
joins if there is need for that. Unfortunately at the moment we
don't ship with a WPS implementation (we're working on it) so if
you need K-nearest neighbour right now you can either try to roll out
your custom extension (by coding it) or try to use 52N WPS implementation (and again code in Java your KNN filter, since they ship
with only 3 sample processes or so):
http://52north.org/index.php?option=com_projects&task=showProject&id=21&Itemid=127

Hope this helps
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to