Radial searches of cartesian points?

Started by Demitri Munaover 14 years ago3 messagesgeneral
Jump to latest
#1Demitri Muna
thatsanicehatyouhave@mac.com

Hi,

I have a data set of several hundred thousand points. Each point is saved as a three dimensional coordinate, i.e. (x, y, z). What I'd like to do is given a point in that space, get a list of all of the points in the table within some radius.

I'm familiar with the q3c package that does this for points that lie on a sphere, but is there something comparable for radial searches on 3D cartesian points? Speed is definitely an issue given the number of points I have.

Thanks for any suggestions!

Cheers,
Demitri

#2Merlin Moncure
mmoncure@gmail.com
In reply to: Demitri Muna (#1)
Re: Radial searches of cartesian points?

On Thu, Jan 5, 2012 at 11:01 AM, <thatsanicehatyouhave@mac.com> wrote:

Hi,

I have a data set of several hundred thousand points. Each point is saved as a three dimensional coordinate, i.e. (x, y, z). What I'd like to do is given a point in that space, get a list of all of the points in the table within some radius.

I'm familiar with the q3c package that does this for points that lie on a sphere, but is there something comparable for radial searches on 3D cartesian points? Speed is definitely an issue given the number of points I have.

Thanks for any suggestions!

see:
http://www.postgresql.org/docs/9.1/interactive/cube.html

and pay special attention to gist indexing portions. cube only
indexes box operations, but you can cull the sphere using 3d distance
formula for points between inner and outer bounding cube.

merlin

#3Demitri Muna
thatsanicehatyouhave@mac.com
In reply to: Merlin Moncure (#2)
Re: Radial searches of cartesian points?

Hi,

On Jan 5, 2012, at 12:54 PM, Merlin Moncure wrote:

see:
http://www.postgresql.org/docs/9.1/interactive/cube.html

and pay special attention to gist indexing portions. cube only
indexes box operations, but you can cull the sphere using 3d distance
formula for points between inner and outer bounding cube.

Thanks for the pointer, Merlin. I had been looking at that, and the bounding boxes idea is good. I'm a little concerned about the very large number of trigonometric calculations this will lead to. For a single, occasional search this would not be an issue, but I'm going to be performing this search thousands of times.

Is anyone aware of a datatype or third-party implementation that will index in three dimensions radially, or what it would take to accomplish this?

Cheers,
Demitri