# [postgis-users] Filtering Points Based On Proximity

Chris Hermansen chris.hermansen at timberline.ca
Mon Mar 24 08:25:03 PDT 2008

```Hi Oliver;

You have a couple of interesting suggestions already, so I feel it's
fair game to ask YOU a question!

Are you sure you don't want to use kriging to solve this problem?
Here's a reference in case you're interested:

http://en.wikipedia.org/wiki/Kriging

The nice thing about kriging - if its use is justified, and you should
not use it if it isn't; see the comments about F-test in the article
above - is that it doesn't throw away points while selecting an
arbitrary one from a close grouping.  In your statement of the problem,
there's a 1/m chance of keeping the "worst" representative height out of
a group of m points within your search radius.  Kriging doesn't have
that problem.

Oliver Monson wrote:
> Hi,
> I'm a very new PostGIS user but I need to solve a somewhat complex
> filtering problem (anyway I think its complex...)
>
> I have around 300,000 points, each with a lat, lon and altitude (also
> converted to geometry). I need to get a subset of those points, where
> none of them are within 5m (or some other arbitrary distance) of each
> other. It doesnt matter which points get picked over another, as long
> as whatever the data set it creates, that none of the points are
> within that 5m radius and that relatively most of the points are used
> (the points are scattered across a 20km squared area). I have other
> data like a timestamp for each point so I can give priority to the
> more recently created points, if that helps as a starting point. If it
> makes it any easier, the altitude can be ignored and we can treat it
> as a set of points on a 2D plane.
> But how would I go about doing this? I really have no idea where to
> start. What would the SQL query look like? Any help would be
> appreciated, thanks!
>
> -Oliver
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

--
Regards,

Chris Hermansen · mailto:clh at timberline.ca
tel:+1.604.714.2878 · fax:+1.604.733.0631
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue · Vancouver BC · Canada · V5Z 1E5

C'est ma façon de parler.

```