pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Stosberg <mark@summersault.com>
To: pgsql-performance@postgresql.org
Subject: Re: application of KNN code to US zipcode searches?
Date: Thu, 17 Feb 2011 10:55:53 -0500
Message-ID: <ijjge9$qtt$1@dough.gmane.org> (raw)
In-Reply-To: <20110217152445.GV4116@tamriel.snowman.net>
References: <ijjc1o$vgu$1@dough.gmane.org>
	<4D5CE118020000250003AB83@gw.wicourts.gov>
	<ijjecs$e8c$1@dough.gmane.org>
	<20110217152445.GV4116@tamriel.snowman.net>

> PostGIS, geometry columns, and UTM..  I'm not sure where they are wrt
> adding KNN support, but it's something they've been anxious to have for
> a while, so I expect support will come quickly.

I've looked into this a little more.

One approach seems to be to project the lat/long pairs on to a flat
plane using the Albers projection (which would be a one-time
calculation), and then the current KNN point/distance calculations could
be used.

Here's a Perl module that references the Albers projection (although
it's not yet clear to me how to use it):

http://search.cpan.org/dist/PDL/

And a Wikipedia page on various calculation possibilities:
http://en.wikipedia.org/wiki/Geographical_distance#Flat-surface_formulae

Further suggestions welcome.

   Thanks,

    Mark




view thread (13+ messages)  latest in thread

Message-ID: <ijjge9$qtt$1@dough.gmane.org>
Permalink:  ../ijjge9$qtt$1@dough.gmane.org/
Also on:    postgresql.org/message-id/ijjge9$qtt$1@dough.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mark@summersault.com
  Subject: Re: application of KNN code to US zipcode searches?
  In-Reply-To: <ijjge9$qtt$1@dough.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox