module Geolookup::USA::Zipcodes

Constants

ZIP_LAT_LONG_FILE

In the future if zip information is updated in mysql, the yml can be recreated via the following zip_lat_long_data = {} ZipCityGeolocationMapping.find_each {|zip| zip_lat_long_data = {lat_int: zip.lat_int, long_int: zip.long_int}} File.open('ZIP_LAT_LONG.yml', “w”) {|file| file.puts zip_lat_long_data.to_yaml}

Public Class Methods

lat_long(zipcode) click to toggle source
# File lib/geolookup/usa/zipcodes.rb, line 11
def self.lat_long(zipcode)
  @zip_lat_long_hash ||= Geolookup.load_hash_from_file(ZIP_LAT_LONG_FILE)
  @zip_lat_long_hash[zipcode.to_i] || {}
end