Re: [HACKERS] Indexing for geographic objects?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Franck Martin <franck(at)sopac(dot)org>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Indexing for geographic objects?
Date: 2000-11-26 04:35:40
Message-ID: 28140.975213340@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Franck Martin <franck(at)sopac(dot)org> writes:
> I would greatly appreciate if someone could guide me through the
> methodology to build an index for a custom type or point me to some
> readings where the algorithm is explained (web, book, etc...).

The Programmer's Guide chapter "Interfacing Extensions To Indices"
outlines the procedure for making a new datatype indexable. It
only discusses the case of adding btree support for a new type,
though. For other index classes such as R-tree there are different
sets of required operators, which are not as well documented but
you can find out by looking at code for the already-supported
datatypes.

> I plan to use 3D geographical objects...

That's a bit hard since we don't have any indexes suitable for 3-D
coordinates --- the existing R-tree type is for 2-D objects. What's
more it assumes that coordinates are Euclidean, which is probably
not the model you want for geographical coordinates.

In theory you could build a new index type suitable for indexing
3-D points, using the R-tree code as a starting point. I wouldn't
class it as a project suitable for a newbie however :-(.

Depending on what your needs are, you might be able to get by with
projecting your objects into a flat 2-D coordinate system and using
an R-tree index in that space. It'd just be approximate but that
might be close enough for index purposes.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew McMillan 2000-11-26 10:33:39 Re: Skipping numbers in a sequence.
Previous Message GH 2000-11-26 01:39:13 Re: PostgreSQL as windows 2000 Service

Browse pgsql-hackers by date

  From Date Subject
Next Message Alain Toussaint 2000-11-26 05:07:46 Re: Re: [NOVICE] Re: re : PHP and persistent connections
Previous Message Tom Lane 2000-11-26 02:55:18 Proposal for fixing IPC key assignment