Skip to content

Instantly share code, notes, and snippets.

@waynegraham
Created July 22, 2020 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waynegraham/030786613fe095378cdcfed6b51dfaac to your computer and use it in GitHub Desktop.
Save waynegraham/030786613fe095378cdcfed6b51dfaac to your computer and use it in GitHub Desktop.
Spatial Test
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'colorize'
gem 'geo_names'
gem "geocoder"
gem "dotenv"
require 'colorize'
require 'dotenv'
require 'geo_names'
Dotenv.load
# TODO: titleize and dedupe
places = File.readlines('dlme-cho-spatial-values.txt')
GeoNames.configure do |config|
config.username = ENV['GEONAMES_USERNAME']
end
places.each do |place|
criteria = { q: place }
result = GeoNames::Search.search(criteria)
if result['totalResultsCount'] > 0
puts result
else
puts "Nothing returned for #{place}".red
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment