hk_geo 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +17 -1
- data/Rakefile +1 -0
- data/lib/hk_geo.rb +2 -1
- data/test/test_hk_geo.rb +8 -1
- metadata +3 -3
data/README.txt
CHANGED
@@ -7,10 +7,18 @@ A Geo location conversion API for HK.
|
|
7
7
|
== Dependency
|
8
8
|
|
9
9
|
* mechanize
|
10
|
+
* rest-client
|
11
|
+
* nayutaya-googlemaps-polyline
|
10
12
|
* hoe (build)
|
11
13
|
|
14
|
+
== Install
|
15
|
+
|
16
|
+
gem install hk_geo
|
17
|
+
|
12
18
|
== Usage
|
13
19
|
|
20
|
+
=== Conversion API
|
21
|
+
|
14
22
|
By default, convert the HK80 location to WGS84/ITRF96
|
15
23
|
|
16
24
|
require 'hk_geo'
|
@@ -23,9 +31,17 @@ You may specify other conversion
|
|
23
31
|
result = HkGeo::Converter.convert("835352.749", "815640.774", HkGeo::SYSTEM_HK80, HkGeo::SYSTEM_ITRF96, HkGeo::UNIT_DM)
|
24
32
|
>> ["22.2745130", "113.5858818"]
|
25
33
|
|
34
|
+
=== Route Finder API
|
35
|
+
|
36
|
+
Use two coordinate to find the route between
|
37
|
+
|
38
|
+
data = HkGeo::RouteFinder.route("22.445663383,113.983328736", "22.444075388,113.984268260")
|
39
|
+
>> [[22.44557, 113.98324, 3], [22.44487, 113.9839, 0], [22.4431, 113.98512, 1], [22.4424, 113.98548, 0], [22.44182, 113.98568, 0], [22.44122, 113.98581, 0], [22.44078, 113.98582, 1], [22.44044, 113.98581, 0], [22.43885, 113.98556, 0], [22.43727, 113.98526, 0], [22.43569, 113.98487, 1] ... (skipped)
|
40
|
+
|
26
41
|
Check the test for more info.
|
27
42
|
|
28
43
|
== Credit
|
29
44
|
|
30
|
-
|
45
|
+
The conversion api rely on the online conversion tool from Survey and Mapping Office. http://www.geodetic.gov.hk/smo/tform/tra_tform.aspx
|
46
|
+
|
31
47
|
|
data/Rakefile
CHANGED
data/lib/hk_geo.rb
CHANGED
data/test/test_hk_geo.rb
CHANGED
@@ -13,6 +13,13 @@ class TestHkGeo < Test::Unit::TestCase
|
|
13
13
|
assert_not_nil(result)
|
14
14
|
assert_equal("22.2745130", result[0])
|
15
15
|
assert_equal("113.5858818", result[1])
|
16
|
-
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_route
|
19
|
+
result1 = HkGeo::Converter.convert("834038.674", "816345.067")
|
20
|
+
result2 = HkGeo::Converter.convert("833862.7", "816441.553")
|
21
|
+
|
22
|
+
data = HkGeo::RouteFinder.route(result1.join(","), result2.join(","))
|
23
|
+
puts data.inspect
|
17
24
|
end
|
18
25
|
end
|
metadata
CHANGED