Skip to content

Instantly share code, notes, and snippets.

# Based on http://gist.github.com/258730 and on http://www.nearby.org.uk/tests/GeoTools.html. Not yet working properly
module OsCoordsUtilities
E2 = 0.0066705397616 # OSI eccentricity squared
A = 6377563.396 # OSI semi-major
B = 6356256.910 # OSI semi-minor
extend self
def convert_os_to_wgs84(eastings, northings, height=0)
class OnsDatasetFinder
require 'httpclient'
BaseUrl = "http://neighbourhood.statistics.gov.uk/dissemination/"
def self.process
all_datasets = []
home_page = "http://neighbourhood.statistics.gov.uk/dissemination/Download1.do"
parsed_page = get_page(home_page)
dataset_group_paths = parsed_page.search('#mainContent3 li a[@href*="datasetList.do"]').collect {|ds| ds[:href]}.uniq
class OnsReader
require 'httpclient'
BaseUrl = "http://neighbourhood.statistics.gov.uk/dissemination/"
def self.process
sets = YAML.load_file(File.join(RAILS_ROOT, "db/ons_data", "current_datasets.yml"))[0..100]
client = HTTPClient.new
sets.each do |set|
url = set[:url]