Archive for September, 2011

Converting ordnance survey coordinates into templates within wikipedia markup

Use the following script (Uses osgb from pypi)

#!/usr/bin/python
import osgb.convert
import sys
import re

def convert(x):
    long, lat = osgb.convert.osgb_to_lonlat(x.group(0))
    return '%s ({{coord|%.3f|%.3f|source:enwiki-osgb36(%s)}})' % (x.group(0), lat, long, x.group(0))


data = sys.stdin.read()
print re.sub('[A-Z][A-Z][0-9]{6}', convert, data)
Advertisements

September 15, 2011 at 12:10 am Leave a comment


September 2011
M T W T F S S
« Jul   Oct »
 1234
567891011
12131415161718
19202122232425
2627282930