Purely as a thought-experiment (cough), a wee ruby script that you might be able to adapt.

#!/usr/local/bin/ruby

#
# Example
# >./pofinder G38DN
# >55.866061 -4.273608
#

require 'rubygems'
require 'mechanize'

agent = WWW::Mechanize.new

postcode = ARGV[0]
begin
  gmap_url = "http://maps.google.com/maps?q="+postcode.gsub(' ', "+")
  gmap = agent.get(gmap_url).root.to_s;
rescue
  puts "Cannot derive coordinates for that postcode"
end

if matches = /lat:\s*(-?[0-9\.]+),\s*lng:\s*(-?[0-9\.]+)/.match(gmap)
  latitude = matches[1]
  longitude = matches[2]
  printf("%s %s\n", latitude, longitude)
end




On 16 Nov 2006, at 23:00, Dave Cross wrote:


I've got a couple of hundred full UK postcodes that I want to convert to lat/long values. And I thought to myself 1/ Postcoder would be the perfect tool to do that with and 2/ when I was working on Postcoder earlier this year there was lots of talk about releasing the API as part
of Backstage. But there were licensing problems.

So I just thought I'd ask if those licensing problems were any nearer to being solved and whether the Postcoder API was any closer to being made public.

Or, failing that, what other tools do people use to convert postcodes to lat/long? It seems to me that the Google Maps GeoCoder object doesn't understand UK postcodes.

Cheers,

Dave...
-
Sent via the backstage.bbc.co.uk discussion group. To unsubscribe, please visit http://backstage.bbc.co.uk/archives/2005/01/ mailing_list.html. Unofficial list archive: http://www.mail- archive.com/backstage@lists.bbc.co.uk/

-
Sent via the backstage.bbc.co.uk discussion group.  To unsubscribe, please 
visit http://backstage.bbc.co.uk/archives/2005/01/mailing_list.html.  
Unofficial list archive: http://www.mail-archive.com/backstage@lists.bbc.co.uk/

Reply via email to