UK Postcode to lat&long

The Royal Mail’s postcode to NGR and Lat/Long database has been leaked and is available from UK government database of all 1,841,177 post codes together with precise geographic coordinates and other information, 8 Jul 2009 - WikiLeaks

The information is now public and whilst the Royal Mail are not happy there is little they can do about people using the information.

The file is about 21Mb and is compressed with bzip2. People with computers running proper software will be able to uncompress that with no problem whilst Windows users will need to download a bzip2 compatible uncompressor. :slight_smile: Uncompressed it is about 240MB and is a simple comma delimited text file. Excel can happily read it. There is no address information included, it is merely postcodes to NGR and latitude and longitude.

The availablity of this data should finally end any questions about which postcode applies to any particular UK SOTA summit.

Andy
MA0FMF

Couldn’t this already be done on http://www.nearby.org.uk ?

Tom M1EYP

In reply to M1EYP:

Possibly Tom. www.nearby.org.uk may have licensed the same database.

The difference being you don’t know how www.nearby.org.uk gives you the results it does. Also you have no guarantee that www.nearby.org.uk will be running tomorrow when you need to convert from one to the other. It is a classic outsourcing problem… do I invest time/money/resources in doing something myself or do I use somebody else’s resources and hope they don’t outsource to another who will not let me use the service.

Andy
MA0FMF

In reply to MM0FMF:

The availablity of this data should finally end any questions about
which postcode applies to any particular UK SOTA summit.

I haven’t seen the data yet, but 2 points spring to mind.

1 Postcode to location is not the same as location to postcode.

2 This is presumably a 1-off leak. The postcode database does change from time to time.

Personally I think the idea of a summit having a postcode is meaningless.

In reply to M1MAJ:

Personally I think the idea of a summit having a postcode is meaningless.

Indeed it is. But there are times when this meaningless information is needed. RSGB contests, In-car GPS units etc.

Andy
MA0FMF

I have been known to arrive on SOTA summits for a contest, and suddenly realise I’ve not done my homework. I then spend time calling on the radio and 'phoning people up trying to ascertain my Maidenhead locator and district code (usually, but not always, the same as the postcode)!

A recent time out was the 5th 2m Backpackers on Gun SP-013. I did indeed forget to research everything. Listening into the main weekend 144MHz event, I was relieved to find that district codes were not part of the exchange, as I had no idea whether it would have been ST, SK, DY or CW. The Maidenhead locator I tried to work out from other known ones (and very vague memory), and came to the conclusion that it was IO83XD. I was mighty relieved to find out later that this was indeed correct!

Tom M1EYP

In reply to M1EYP:
I recently did the WAB 2m QRP contest as a mobile moving from square to square.
The RSGB 2m and backpackers were on at the same time they wanted locators - discovered my Garmin Etrex has maidenhead as a choice - problem solved :slight_smile: Shame it doesn’t do post codes :frowning:

Roger G4OWG

In reply to MM0FMF:
Interesting site that one Andy.
See New Digital Master Map for Great Britian: Confidential Advice to Ministers, 2009 - WikiLeaks

For how the OS (a public funded body) operate to the disadvantage of us punters who pay for them.

Roger G4OWG

In reply to G4OWG:

discovered my Garmin Etrex has maidenhead as a choice

I don’t think I’ve ever seen a handheld GPS that doesn’t offer Maidenhead. The problem is you often want several formats at the same time such as Maidenhead and NGR and with my Vista HCx it’s an either/or situation.

It wouldn’t be hard to offer a Maidenhead to Postcode lookup. There are obvious problems that Martyn has alluded to in that there is often no 1:1 correlation between these items. But it’s not rocket science to offer something, RSGB contests use the postcode district as a multiplier e.g. everyone in GI uses BT.

Of course doing the lookup in the field is harder.

Andy
MA0FMF

In reply to MM0FMF:
Not that difficult Andy , Display Location , and switch between Maidenhead and British Grid in setup. Got it down to about 20secs each way :slight_smile:

Roger G4OWG

In reply to M1EYP:

Hi Tom

I’ve also found that www.nearby.org.uk has been a good source of
conversion data for a considerable time now. I suppose any source
of data can disappear, but then another one comes along!

Kind regards

Dave G0ELJ

In reply to MM0FMF:

Excel can happily read it.

i have just opened this file in excel and seperated into rows and columns for easy reading

and i quote from excel

“You are trying to open a file that contains more than 65,536 rows or 256 columns.”

it would be nice to have the full list in excel format so i can convert to a database

any ideas ??

p.s. i am using Excel 2003

Matt, M3WDS

In reply to MM0FMF:
Hi Andy.Streetmap.co.uk Also gives a direct conversion from postcode to lat lomg and wab locator.ATB Geoff

In reply to M3WDS:

it would be nice to have the full list in excel format so i can convert to a
database

any ideas ??

Sorry I should have said that Excel imports the comma delimited format OK but you’ll need to split the file into manageable sizes.

split -l 25000 uk-post-codes-2009 posts

That will give you 66 25000 line files to play with.

Better would be to use Python and its SQL modules to import the database straight into SQL. Then you can knock up a simple bit of code to handle the queries from a webpage or whatever. You could use Perl if you must!

Andy
MA0FMF

In reply to MM0FMF:

Thanks Alot Andy - will have a play later after ive been to that 4 letter word (Work) lol

am hoping to use it and convert to mysql database on my internal network (intranet) to start with as a test

im always going between different areas visiting friends etc so the idea is that i can type a post code in and it tells me the nearest hills / sota & wota summits etc to my location so i can easily find somewhere for portable radio activities :slight_smile:

all going well and if it works properly it may go on my website

Many Thanks

73
Matt M3WDS

In reply to M3WDS:

If you download the callsign database that G3ZHI was pushing then you could mash the two together. Enter a postcode and a radial distance and get a list of all the summits with that distance. Or a list of all the amateurs within that distance from the postcode. Or enter a callsign and get a list of all the summits etc. etc.

I’m sure there’s interesting stuff you can do with these geographical databases and the data in the chaser logs. You should be able to map (GoogleMaps API) the location of chasers vs. band vs. summit worked. Combine that with time and you should be able to enter a summit and get the answer of when the best time to activate it is and which directions to beam for the VHF bands! :wink:

Andy
MA0FMF

Andy,

I was experimenting with generating Google Earth and Google Maps of Contacts from my Logs a few weeks ago, Here is a link for an example that shows all my 6m Contacts for 2009:

http://www.g0lgs.co.uk/log2kml.php?myview=6m2009&submit=view

(If your computer is a bit slow it may hang as this is quite large).

Sounds like my Server is going to be doing some more stuff soon (as M3WDS is my son and uses it too).

Stewart G0LGS

In reply to MM0FMF:

The latest version of Excel (Office 2007) will handle much more than 65000 rows & 256 columns. I have office 2007 at work, but only office 2000 at home, which does suffer from the above problem. I haven’t tried it myself yet but I have a feeling older versions of Microsoft Access will handle more than that number of rows & columns in a table.

73,

Mark G0VOF

In reply to G0VOF:

Mark, if your employer has a license agreement with m/s for all employees to use office then you can obtain the full office 2007 suite under the “Home use” program. I got it & paid about £8 off the top of my head for admin & postage. It may be worth asking your employers.

In reply to G1INK:

Thanks for the advice Steve, that certainly is worth bearing in mind. As I connect remotely to the work IT system when I have to work from home I don’t really need Office 2007 at home. Besides, call me old fashoined but I do prefer Office 2000, even though Office 2007 is more capable :wink:

It was very nice to work you from SP-001 on 2m earlier, I listened on 40m but you were right down in the noise here.

I hope you had a good day today, despite your un-enviable task this morning.

Keep well & hope to work you again very soon.

73,

Mark G0VOF