geocoder 1.4.6 → 1.4.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of geocoder might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -4
- data/lib/geocoder/lookups/location_iq.rb +5 -5
- data/lib/geocoder/lookups/nominatim.rb +13 -5
- data/lib/geocoder/results/google.rb +16 -5
- data/lib/geocoder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dab954ab0ccd1f5c7829f019e78b754a950939c1
|
4
|
+
data.tar.gz: 8dd3db6e80446b91d9c35f9b2ad0f73a5bc28f0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f796a95c55636b84fd46a58dd7c5e8c96ffea757270d6b8aba584abcc2634e3c30d6cce30fa6d1abf7d8ed683fecf43db6e0f1ec9512ed4b1f607786ba0289cc
|
7
|
+
data.tar.gz: f87b1b4860241b21a2ecebfeb8345660acf6c51d92483957eb9ec84999752588c75b4e3248366ecf591919859b8c1880c6d7d0fd29dbd67253443945cfce99a2
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@ Changelog
|
|
3
3
|
|
4
4
|
Major changes to Geocoder for each release. Please see the Git log for complete list of changes.
|
5
5
|
|
6
|
+
1.4.7 (2018 Mar 13)
|
7
|
+
-------------------
|
8
|
+
* Allow HTTP protocol for Nominatim.
|
9
|
+
|
6
10
|
1.4.6 (2018 Feb 28)
|
7
11
|
-------------------
|
8
12
|
* Add support for :ipdata_co lookup (thanks github.com/roschaefer).
|
data/README.md
CHANGED
@@ -156,10 +156,10 @@ Please use MongoDB's [geospatial query language](https://docs.mongodb.org/manual
|
|
156
156
|
|
157
157
|
To find objects by location, use the following scopes:
|
158
158
|
|
159
|
-
Venue.near('Omaha, NE, US'
|
160
|
-
Venue.near([40.71, -100.23],
|
161
|
-
Venue.near([40.71, -100.23],
|
162
|
-
# venues within
|
159
|
+
Venue.near('Omaha, NE, US') # venues within 20 (default) miles of Omaha
|
160
|
+
Venue.near([40.71, -100.23], 50) # venues within 50 miles of a point
|
161
|
+
Venue.near([40.71, -100.23], 50, :units => :km)
|
162
|
+
# venues within 50 kilometres of a point
|
163
163
|
Venue.geocoded # venues with coordinates
|
164
164
|
Venue.not_geocoded # venues without coordinates
|
165
165
|
|
@@ -13,15 +13,15 @@ module Geocoder::Lookup
|
|
13
13
|
|
14
14
|
def query_url(query)
|
15
15
|
method = query.reverse_geocode? ? "reverse" : "search"
|
16
|
-
"#{protocol}
|
17
|
-
end
|
18
|
-
|
19
|
-
def supported_protocols
|
20
|
-
[:http, :https]
|
16
|
+
"#{protocol}://#{configured_host}/v1/#{method}.php?key=#{configuration.api_key}&" + url_query_string(query)
|
21
17
|
end
|
22
18
|
|
23
19
|
private
|
24
20
|
|
21
|
+
def configured_host
|
22
|
+
configuration[:host] || "locationiq.org"
|
23
|
+
end
|
24
|
+
|
25
25
|
def results(query)
|
26
26
|
return [] unless doc = fetch_data(query)
|
27
27
|
|
@@ -14,15 +14,23 @@ module Geocoder::Lookup
|
|
14
14
|
|
15
15
|
def query_url(query)
|
16
16
|
method = query.reverse_geocode? ? "reverse" : "search"
|
17
|
-
|
18
|
-
"#{protocol}://#{host}/#{method}?" + url_query_string(query)
|
17
|
+
"#{protocol}://#{configured_host}/#{method}?" + url_query_string(query)
|
19
18
|
end
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
private # ---------------------------------------------------------------
|
21
|
+
|
22
|
+
def configured_host
|
23
|
+
configuration[:host] || "nominatim.openstreetmap.org"
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
+
def use_ssl?
|
27
|
+
# nominatim.openstreetmap.org redirects HTTP requests to HTTPS
|
28
|
+
if configured_host == "nominatim.openstreetmap.org"
|
29
|
+
true
|
30
|
+
else
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
26
34
|
|
27
35
|
def results(query)
|
28
36
|
return [] unless doc = fetch_data(query)
|
@@ -120,19 +120,30 @@ module Geocoder::Result
|
|
120
120
|
def precision
|
121
121
|
geometry['location_type'] if geometry
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
def partial_match
|
125
125
|
@data['partial_match']
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
def place_id
|
129
129
|
@data['place_id']
|
130
|
-
end
|
130
|
+
end
|
131
131
|
|
132
132
|
def viewport
|
133
133
|
viewport = geometry['viewport'] || fail
|
134
|
-
|
135
|
-
|
134
|
+
bounding_box_from viewport
|
135
|
+
end
|
136
|
+
|
137
|
+
def bounds
|
138
|
+
bounding_box_from geometry['bounds']
|
139
|
+
end
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
def bounding_box_from(box)
|
144
|
+
return nil unless box
|
145
|
+
south, west = %w(lat lng).map { |c| box['southwest'][c] }
|
146
|
+
north, east = %w(lat lng).map { |c| box['northeast'][c] }
|
136
147
|
[south, west, north, east]
|
137
148
|
end
|
138
149
|
end
|
data/lib/geocoder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geocoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Reisner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides object geocoding (by street or IP address), reverse geocoding
|
14
14
|
(coordinates to street address), distance queries for ActiveRecord and Mongoid,
|