Writing

Get geo-position coordinates from a UK postcode with Ruby

Introducing Pat, an ultra-lightweight Ruby gem for postcode->geolocation in the UK.

Introducing Pat , au ultra-lightweight Ruby gem for postcode->geolocation in the UK.

It’s easy to install:

sudo gem install pat

And easy to use. (Try it from the command-line with irb -r rubygems -r pat)

postcode = Pat.get(“SW1A 2TT”)

postcode["geo"]["lat"]

=> “51.502308″

postcode["geo"]["lng"]

=> “-0.124345″

Source code for Pat here .

I hope someone finds it useful.

archived copy

Around the same time

Earlier in writing: Tweet an MP. Later in writing: Grandma’s House – a short film.

About this piece

First published .