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 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
- This api rely on the online conversion tool from Survey and Mapping Office. http://www.geodetic.gov.hk/smo/tform/tra_tform.aspx
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
@@ -3,6 +3,7 @@ require 'hoe'
3
3
 
4
4
  $: << 'lib'
5
5
  require './lib/hk_geo.rb'
6
+ require './lib/tasks/route_finder.rb'
6
7
 
7
8
  Hoe.plugin :gemcutter
8
9
  Hoe.spec 'hk_geo' do
data/lib/hk_geo.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'hk_geo/converter'
2
+ require 'hk_geo/route_finder'
2
3
 
3
4
  module HkGeo
4
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
5
6
  end
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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hk_geo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Francis Chong