google_timeline 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google_timeline/google_map_timeline.rb +12 -13
- data/lib/google_timeline/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: 544e2424574d2316af29b04e923bd5c2d4e5db00
|
4
|
+
data.tar.gz: ee22f128d7e5abe4a46a85936055ef93f4b9121a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd4f77e1caf5091535fb1473e253aef3ca4aaaf440ab6554ab314c53a6f4d38f27d870273e15986b2261b467468b2d49421ab4a0e2c56cafd63137bfd139188f
|
7
|
+
data.tar.gz: dcc29c29aea18d262c62d0bdf4d56690a78584b5974e44983dbc29363918ccd00eea255ef2cad3f0fe463660809933df2eb2d0397591d0929007b8c67cbc91b2
|
@@ -18,21 +18,20 @@ class GoogleMapTimeline
|
|
18
18
|
if key.nil? == false and File.exists?(value)
|
19
19
|
kml = File.read(value)
|
20
20
|
doc = Nokogiri::XML(kml)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
location_str = polylines_encoding(coordinates)
|
21
|
+
coordinates = doc.search('coordinates').map{|c| c.content.split(" ")}.flatten.map{|co| co.split(",")[0..1].reverse.map{|co1| co1.to_f}} rescue []
|
22
|
+
if coordinates.is_a?(Array)
|
23
|
+
location_str = polylines_encoding(coordinates)
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
if location_str.length > 1900
|
26
|
+
coordinates_dup = coordinates.dup
|
27
|
+
while location_str.length > 1900 do
|
28
|
+
coordinates_dup = coordinates_dup.values_at(* coordinates_dup.each_index.select {|i| i.even?})
|
29
|
+
location_str = polylines_encoding(coordinates_dup)
|
30
|
+
end
|
32
31
|
end
|
32
|
+
url = location_url(location_str)
|
33
33
|
end
|
34
|
-
|
35
|
-
|
34
|
+
|
36
35
|
end
|
37
36
|
op_hash[:url] = url
|
38
37
|
|
@@ -49,7 +48,7 @@ class GoogleMapTimeline
|
|
49
48
|
end
|
50
49
|
|
51
50
|
def polylines_encoding(str)
|
52
|
-
Polylines::Encoder.encode_points(str)
|
51
|
+
Polylines::Encoder.encode_points(str).gsub("\\", '%5c')
|
53
52
|
end
|
54
53
|
|
55
54
|
def default_map
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_timeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Surajit Khan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: polylines
|