From 888293959e84ca619bd8a1acdde2a77a1b7b49e8 Mon Sep 17 00:00:00 2001 From: Fernando Alonso <krakatoa1987@gmail.com> Date: Tue, 6 May 2014 16:29:09 -0300 Subject: [PATCH] Fix: (Maxmind) add latitude and longitude columns when using the City package, fixes #coordinates --- lib/geocoder/lookups/maxmind_local.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/geocoder/lookups/maxmind_local.rb b/lib/geocoder/lookups/maxmind_local.rb index 0fa5d867..7a744038 100644 --- a/lib/geocoder/lookups/maxmind_local.rb +++ b/lib/geocoder/lookups/maxmind_local.rb @@ -34,10 +34,10 @@ module Geocoder::Lookup result.nil? ? [] : [result.to_hash] elsif configuration[:package] == :city addr = IPAddr.new(query.text).to_i - q = "SELECT l.country, l.region, l.city + q = "SELECT l.country, l.region, l.city, l.latitude, l.longitude FROM maxmind_geolite_city_location l JOIN maxmind_geolite_city_blocks b USING (loc_id) WHERE b.start_ip_num <= #{addr} AND #{addr} <= b.end_ip_num" - format_result(q, [:country_name, :region_name, :city_name]) + format_result(q, [:country_name, :region_name, :city_name, :latitude, :longitude]) elsif configuration[:package] == :country addr = IPAddr.new(query.text).to_i q = "SELECT country, country_code FROM maxmind_geolite_country -- GitLab