pre-Git files/Garmin Log renaming.d.rb
# Note that there are other geo services available as of 2013 in Ruby. For example http://www.rubygeocoder.com.
Note that there are other geo services available as of 2013 in Ruby.
Note that there are other geo services available as of 2013 in Ruby .
def loc(arr)
  api = GeoNames.new
  latIn = arr[0]
  longIN = arr[1]
  countryCode = api.country_code(lat: latIn, lng: longIN)
  if countryCode['countryCode'] === "US"
    neigh = api.neighbourhood(lat: latIn, lng: longIN)
    puts "\n74. For #{latIn}, #{longIN}: neigh: #{neigh}" 
    if neigh == nil
      puts "77. Data not available for this location from Zillow. lat, long: #{latIn}, #{longIN}\n   ########### Should find a better source than country_code}" 
      return "#{countryCode['name']}, #{countryCode['adminName1']} #{countryCode['countryName']}" 
    else
      return " 
    end
  else
    return "#{countryCode['name']}, #{countryCode['countryName']}"
  end
end
def loc ( arr ) api = GeoNames . new latIn = arr [ 0 ] longIN = arr [ 1 ] countryCode = api . country_code ( lat : latIn , lng : longIN ) if countryCode [ 'countryCode' ] === "US" neigh = api . neighbourhood ( lat : latIn , lng : longIN ) puts "\n74. For #{latIn}, #{longIN}: neigh: #{neigh}" if neigh == nil puts "77. Data not available for this location from Zillow. lat, long: #{latIn}, #{longIN}\n   ########### Should find a better source than country_code}" return "#{countryCode['name']}, #{countryCode['adminName1']} #{countryCode['countryName']}" else return "#{neigh['name']}, #{neigh['city']}, #{neigh['adminName2']}, #{neigh['adminCode1']}" end else return "#{countryCode['name']}, #{countryCode['countryName']}" end end
Note that there are other geo services available as of 2013 in Ruby.
Note that there are other geo services available as of 2013 in Ruby .
# location = "If you're seeing this sentence, Geocoder isn't set up. Needs to be put in two places" # used with Geocoder which isn't being used with the current version # puts "54. #{arr}" # places_nearby = Geonames::WebService.find_nearby_place_name arr[0], arr[1] # used to work with geonames gem # places_nearby = api.ocean(lat: 0, lng: 0) #   puts "56. places_nearby: #{places_nearby}. " #   puts "57. places_nearby.first.name: #{places_nearby['name']}" #   puts "57. places_nearby.first.name: #{places_nearby.first.name}, places_nearby.first.country_name: #{places_nearby.first.country_name}" # puts "Coordinates input #{arr[0]}, #{arr[1]}" # location = Geocoder.search("#{arr[0]}, #{arr[1]}") # puts "location from Geocoder: #{location}" # if geocoder loaded. If gets good info, maybe change # puts "api.places_nearby['name']: #{api.places_nearby['name']}. api.country_code['countryName']: #{api.country_code['countryName']}" # puts "\n70: #{latIn}, #{longIN}\n" # puts "\n72. countryCode: #{countryCode} \n countryCode['countryCode']: #{countryCode['countryCode']}" # neighborhood only works in the US and is supplied by Zillow # "/n #{neigh['name']}, #{neigh['city']}, #{neigh['adminName2']}, #{neigh['adminCode1']}\n"  #{neigh['name']}, #{neigh['city']}, #{neigh['adminName2']}, #{neigh['adminCode1']}" # Should write a work # doesn't give much information # api.find_nearby should give more information, but I can't figure out how to parse the hash. Could do it, but should be easier # api.find_nearby_wikipedia(latIn longIn) should give more but I can't figure out what the parameters need to be # something for the rest of the world
arr
<not_specific>