geohex-v3 0.0.3 → 0.0.4
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/README.md +4 -0
- data/lib/geohex.rb +1 -11
- data/lib/geohex/v3/zone.rb +4 -5
- data/lib/geohex/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb6401405b3c6af7eb0d0fd3d1d5ac378e0c51ba
|
4
|
+
data.tar.gz: ef320cf628c0854f33350660c4a23623a2e62824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9adeb0a4b86469a7397244cd9e0d29fc09fef1c0f8f7ccfb3e9ba4fc5e3d5bd719beb7c15bdca4185f40adfccefd0868c931de7507b6a38b1a354c01d5abfdc5
|
7
|
+
data.tar.gz: 358c503993459d7f2c7f3a9159c4763360b3e557a6f6ece113630d0a8a52d92fa9a40d903859344ca21ec2252f8aaf4890a6df827e0203024e6a6a51c1494b61
|
data/README.md
CHANGED
data/lib/geohex.rb
CHANGED
@@ -2,15 +2,5 @@ require "geohex/version"
|
|
2
2
|
require "geohex/v3"
|
3
3
|
|
4
4
|
module Geohex
|
5
|
-
|
6
|
-
Geohex::V3::Zone.encode(latitude, longitude, level)
|
7
|
-
end
|
8
|
-
|
9
|
-
def decode(code)
|
10
|
-
Geohex::V3::Zone.decode(code)
|
11
|
-
end
|
12
|
-
|
13
|
-
def getZoneByXY(x, y, level)
|
14
|
-
Geohex::V3::Zone.getZoneByXY(x, y, level)
|
15
|
-
end
|
5
|
+
# Your code goes here...
|
16
6
|
end
|
data/lib/geohex/v3/zone.rb
CHANGED
@@ -28,16 +28,12 @@ module Geohex
|
|
28
28
|
|
29
29
|
instance
|
30
30
|
end
|
31
|
-
|
32
|
-
def getZoneByXY x, y, level
|
33
|
-
instance = self.new
|
34
|
-
instance.getZoneByXY x, y, level
|
35
|
-
end
|
36
31
|
end
|
37
32
|
|
38
33
|
def calcHexSize level
|
39
34
|
H_BASE / (3.0 ** (level + 3))
|
40
35
|
end
|
36
|
+
private :calcHexSize
|
41
37
|
|
42
38
|
def loc2xy lon, lat
|
43
39
|
x = lon * H_BASE / 180
|
@@ -46,6 +42,7 @@ module Geohex
|
|
46
42
|
|
47
43
|
OpenStruct.new :x =>x, :y => y
|
48
44
|
end
|
45
|
+
private :loc2xy
|
49
46
|
|
50
47
|
def xy2loc x, y
|
51
48
|
lon = (x / H_BASE) * 180
|
@@ -54,6 +51,7 @@ module Geohex
|
|
54
51
|
|
55
52
|
OpenStruct.new :lon => lon, :lat => lat
|
56
53
|
end
|
54
|
+
private :xy2loc
|
57
55
|
|
58
56
|
def encode latitude, longitude, level = 7
|
59
57
|
raise ArgumentError, "latitude must be between -90 and 90" unless (-90..90).include? latitude
|
@@ -308,6 +306,7 @@ module Geohex
|
|
308
306
|
|
309
307
|
[ z_loc_y, z_loc_x, h_x, h_y, code ]
|
310
308
|
end
|
309
|
+
private :getZoneByXY
|
311
310
|
|
312
311
|
def adjust_xy x, y, level
|
313
312
|
rev = 0
|
data/lib/geohex/version.rb
CHANGED