Geo::Postcode

[prev] [thread] [next] [Date index for 2004/08/31]

From: william ross
Subject: Geo::Postcode
Date: 18:39 on 31 Aug 2004
Hello,

I've just finished (for now) and uploaded the module that I use to work 
with UK postcodes. It handles validation, parsing, location and the 
common distance-to-here calculation in a fairly economical way, and it 
can deal transparently with postcodes at different resolutions (ie it 
will tell you how far it is from 'SW1' to 'EC1Y 8PQ'), to allow for the 
various data sets that are available.

At the moment it's up as Geo::Postcode, but that may well change in 
order to sit nicely next to similar modules from other countries.

The accuracy of its measurements depends on the data set that it's 
working with. It comes with a basic set of nearly 3000 points that 
pretty much covers all the postcode areas (like 'E1' or 'LA23'), but no 
more. That's enough to get started and rough out an application, but 
for serious public use you will need to license the use of a proper 
postcode set. The module is designed to accept all sorts of data 
sources without too much trouble.

I mention it here because I use it mostly with CDBI apps, so it is 
designed to inflate and deflate cleanly as a has_a. If a class already 
has a se[arate postcode field, it can just be dropped in:

My::Person->has_a( postcode => 'Geo::Postcode' );
My::Cinema->has_a( postcode => 'Geo::Postcode' );

my $distance = $person->postcode->distance_from( $cinema->postcode );

...and much more.

I hope it turns out to be useful, and I'd be very glad of feedback and 
improvements.

best

will

ps. if it hasn't reached your mirror, try www.spanner.org/postcodes/

Geo::Postcode
william ross 18:39 on 31 Aug 2004

Re: Geo::Postcode
Tony Bowden 18:22 on 02 Sep 2004

Re: Geo::Postcode
Drew Taylor 18:27 on 02 Sep 2004

Re: Geo::Postcode
Tony Bowden 18:28 on 02 Sep 2004

Re: Geo::Postcode
Drew Taylor 18:35 on 02 Sep 2004

Re: Geo::Postcode
Tony Bowden 18:35 on 02 Sep 2004

Re: Geo::Postcode
Simon Cozens 18:57 on 02 Sep 2004

Re: Geo::Postcode
Tony Bowden 19:33 on 02 Sep 2004

Re: Geo::Postcode
Simon Cozens 05:44 on 03 Sep 2004

Re: Geo::Postcode
Tony Bowden 08:38 on 03 Sep 2004

Re: Geo::Postcode
Carl Johnstone 09:05 on 03 Sep 2004

Re: Geo::Postcode
Simon Cozens 09:09 on 03 Sep 2004

Re: Geo::Postcode
will 09:19 on 03 Sep 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52