Class: Geogov::DracosGazetteer

Inherits:
Object
  • Object
show all
Defined in:
lib/geogov/providers/dracos_gazetteer.rb

Instance Method Summary collapse

Constructor Details

#initialize(default_url = "http://gazetteer.dracos.vm.bytemark.co.uk") ⇒ DracosGazetteer

Returns a new instance of DracosGazetteer.



3
4
5
# File 'lib/geogov/providers/dracos_gazetteer.rb', line 3

def initialize(default_url = "http://gazetteer.dracos.vm.bytemark.co.uk")
    @base = default_url
end

Instance Method Details

#nearest_place_name(lat, lon) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/geogov/providers/dracos_gazetteer.rb', line 7

def nearest_place_name(lat,lon)
  url = "#{@base}/point/#{lat},#{lon}.json"
  results = Geogov.get_json(url)
  if results && results["place"]
    return results["place"][0]
  else
    return nil
  end
end