---
title: "Get geo-position coordinates from a UK postcode with Ruby"
description: "Introducing Pat, an ultra-lightweight Ruby gem for postcode->geolocation in the UK."
url: "https://stef.io/writing/get-geo-position-coordinates-from-a-uk-postcode-with-ruby"
kind: "writing"
dates: "2010"
status: "archived-only"
---

# 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.

## Links

- [Archived copy](https://web.archive.org/web/20100708195229/https://www.steflewandowski.com/2010/04/get-geo-position-coordinates-from-a-uk-postcode-with-ruby)
