locapoint 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/README +9 -0
- data/Rakefile +1 -1
- data/lib/locapoint/locapoint.rb +4 -5
- data/lib/locapoint/version.rb +2 -2
- metadata +3 -3
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -7,8 +7,14 @@ A ruby library for conversion between LocaPoint and latitude/longuitude notation
|
|
7
7
|
LocaPoint is the state-of-the-art location pointer that can express any location of the world, only with 12 letters.
|
8
8
|
(quoted from http://www.locapoint.com)
|
9
9
|
|
10
|
+
== Install
|
11
|
+
% gem install locapoint
|
12
|
+
|
10
13
|
== Examples
|
11
14
|
|
15
|
+
require 'rubygems'
|
16
|
+
require 'locapoint'
|
17
|
+
|
12
18
|
Locapoint.decode("SD9.XC4.ER9.CY4")
|
13
19
|
> [35.6586477189174, 139.745663667239]
|
14
20
|
|
@@ -17,6 +23,9 @@ LocaPoint is the state-of-the-art location pointer that can express any location
|
|
17
23
|
|
18
24
|
== See Also
|
19
25
|
|
26
|
+
* Project Website: http://locapoint.rubyforge.org
|
27
|
+
* RubyForge Project Page: http://www.rubyforge.org/projects/locapoint
|
28
|
+
* Subversion Repository: http://rubyforge.org/cgi-bin/viewvc.cgi/?root=locapoint
|
20
29
|
* LocaPoint Official Site: http://www.locapoint.com
|
21
30
|
* LocaPoint Specifications: http://www.locapoint.com/en/spec.html
|
22
31
|
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ require 'fileutils'
|
|
10
10
|
include FileUtils
|
11
11
|
require File.join(File.dirname(__FILE__), 'lib', 'locapoint', 'version')
|
12
12
|
|
13
|
-
AUTHOR = "
|
13
|
+
AUTHOR = "Yohji Shidara"
|
14
14
|
EMAIL = "dara@shidara.net"
|
15
15
|
DESCRIPTION = "LocaPoint conversion library"
|
16
16
|
RUBYFORGE_PROJECT = "locapoint"
|
data/lib/locapoint/locapoint.rb
CHANGED
@@ -7,12 +7,12 @@ Copyright (c) 2006 Yohji Shidara, under MIT License
|
|
7
7
|
module Locapoint
|
8
8
|
# Regular expression that matches LocaPoint strings.
|
9
9
|
LOCAPOINT_REGEXP = /[A-Z][A-Z][0-9]\.[A-Z][A-Z][0-9]\.[A-Z][A-Z][0-9]\.[A-Z][A-Z][0-9]/
|
10
|
-
|
10
|
+
|
11
11
|
# Exception thrown by LocaPoint format errors.
|
12
12
|
class FormatError < Exception; end
|
13
|
-
|
13
|
+
|
14
14
|
# Will convert a LocaPoint string into a pair of +latitude+ and +longitude+.
|
15
|
-
def decode(locapoint)
|
15
|
+
def self.decode(locapoint)
|
16
16
|
unless locapoint =~ LOCAPOINT_REGEXP && locapoint.size == 15
|
17
17
|
raise FormatError, "Invalid format"
|
18
18
|
end
|
@@ -34,7 +34,7 @@ module Locapoint
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# Will convert latitude and longitude into LocaPoint string.
|
37
|
-
def encode(latitude, longitude)
|
37
|
+
def self.encode(latitude, longitude)
|
38
38
|
latitude_step = (latitude.to_f + 90) / 180 * 45697600;
|
39
39
|
longitude_step = (longitude.to_f + 180) / 360 * 45697600;
|
40
40
|
|
@@ -57,5 +57,4 @@ module Locapoint
|
|
57
57
|
|
58
58
|
return s
|
59
59
|
end
|
60
|
-
module_function :decode, :encode
|
61
60
|
end
|
data/lib/locapoint/version.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: locapoint
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2006-10-
|
6
|
+
version: 0.0.2
|
7
|
+
date: 2006-10-25 00:00:00 +09:00
|
8
8
|
summary: LocaPoint conversion library
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -27,7 +27,7 @@ signing_key:
|
|
27
27
|
cert_chain:
|
28
28
|
post_install_message:
|
29
29
|
authors:
|
30
|
-
-
|
30
|
+
- Yohji Shidara
|
31
31
|
files:
|
32
32
|
- README
|
33
33
|
- CHANGELOG
|