lib/cloudmade/geocoding.rb
def find_closest(object_type, lat, lon, options = {})
      lat_lon = "#{CGI.escape(lat.to_s + '+' + lon.to_s)}"
      request = "/closest/#{object_type}/#{lat_lon}.js?#{Service.to_url_params(options)}"
      geo_results = GeoResults.new(JSON.parse(connect request))
      raise ObjectNotFound.new if (geo_results.results == nil or geo_results.results.size == 0)
      return geo_results.results[0]
    end
def find_closest(object_type, lat, lon, options = {})
      lat_lon = "#{CGI.escape(lat.to_s + '+' + lon.to_s)}"
      request = "/closest/#{object_type}/#{lat_lon}.js?#{Service.to_url_params(options)}"
      geo_results = GeoResults.new(JSON.parse(connect request))
      raise ObjectNotFound.new if (geo_results.results == nil or geo_results.results.size == 0)
      return geo_results.results[0]
    end
def find_closest ( object_type , lat , lon , options = { } ) lat_lon = "#{CGI.escape(lat.to_s + '+' + lon.to_s)}" request = "/closest/#{object_type}/#{lat_lon}.js?#{Service.to_url_params(options)}" geo_results = GeoResults . new ( JSON . parse ( connect request ) ) raise ObjectNotFound . new if ( geo_results . results == nil or geo_results . results . size == 0 ) return geo_results . results [ 0 ] end
Find closest object to a given point.
 For a list of available object types, see:
 http://www.cloudmade.com/developers/docs/geocoding-http-api/object_types
 Returns GeoResult object, that contain found objects.
 Raise ObjectNotFound: Raised when no object could be found in radius of 50 km from point.

 * +object_type+ Type of object, that should be searched.
 * +point+ Closest object to this point will be searched.
 * +options+ are
 * +return_geometry+ If specified, adds geometry in returned results. Defaults to true
 TODO: Modify lat, lon parameters to point
Find closest object to a given point . For a list of available object types see : http : // www . cloudmade . com / developers / docs / geocoding - http - api / object_types Returns GeoResult object that contain found objects . Raise ObjectNotFound : Raised when no object could be found in radius of 50 km from point .