Sha256: e5a1a03ecb3c510957495fe7330fd4e49cb835306075cb42488764e6215b2e7f
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'geocoder/lookups/base' require "geocoder/results/nominatim" module Geocoder::Lookup class Nominatim < Base def map_link_url(coordinates) "http://www.openstreetmap.org/?lat=#{coordinates[0]}&lon=#{coordinates[1]}&zoom=15&layers=M" end private # --------------------------------------------------------------- def results(query) return [] unless doc = fetch_data(query) doc.is_a?(Array) ? doc : [doc] end def query_url_params(query) params = super.merge( :format => "json", :polygon => "1", :addressdetails => "1", :"accept-language" => Geocoder::Configuration.language ) if query.reverse_geocode? lat,lon = query.coordinates params[:lat] = lat params[:lon] = lon else params[:q] = query.sanitized_text end params end def query_url(query) method = query.reverse_geocode? ? "reverse" : "search" "#{protocol}://nominatim.openstreetmap.org/#{method}?" + url_query_string(query) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geocoder-1.1.5 | lib/geocoder/lookups/nominatim.rb |