Sha256: c72f909b3c43dd21650bbc168d113740c827a75ef46849519f54b76d7a5c7007
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
module OpenStreetMap class Client # Reverse geocoding generates an address from a latitude and longitude module Reverse def reverse(args = {}) response = RestClient.get("#{BASE_URI}reverse?#{reverse_args_to_url(args)}") args[:format] == 'xml' ? response.body : JSON.parse(response.body) rescue { 'errors' => 'Bad request' } end private def reverse_args_to_url(args, result = []) valid_reverse_args(args).each do |key, value| result << "#{key}=#{value}" end result.join('&') end def valid_reverse_args(args) args.slice(:format, :lat, :lon, :zoom, :addressdetails, :extratags, :namedetails) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
open_street_map-1.0 | lib/open_street_map/client/reverse.rb |