Re: [HACKERS] Indexing for geographic objects? - Mailing list pgsql-general

From Tom Lane
Subject Re: [HACKERS] Indexing for geographic objects?
Date
Msg-id 28140.975213340@sss.pgh.pa.us
Whole thread Raw
In response to Indexing for geographic objects?  (Franck Martin <franck@sopac.org>)
List pgsql-general
Franck Martin <franck@sopac.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

pgsql-general by date:

Previous
From: GH
Date:
Subject: Re: PostgreSQL as windows 2000 Service
Next
From: Michael Ansley
Date:
Subject: RE: [HACKERS] Indexing for geographic objects?