geodesic_wgs84 1.32.11 → 1.32.12
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/ext/geodesic_wgs84/geodesic_wgs84.c +10 -32
- data/lib/geodesic_wgs84/version.rb +1 -1
- data/spec/geodesic_wgs84_spec.rb +29 -33
- 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: 99b89d9bb56862dd37c16b95c46ddef1bd69267f
|
|
4
|
+
data.tar.gz: 08d962eaf9b23f25e0d55212bbbae2f31b746a3c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c36c98c1bef95b54a2b5fef593c75ef59cf04e02ca89d3768fab87fc643dce5b651f074e4c59d1bcff7f20057090128d8c0138375ba62869aff7f7f193794dd
|
|
7
|
+
data.tar.gz: 419cc35d4f3d48e858ddd1070859421c02b21a40c0babc9bd0c2fcdb71a8f5a7562abaf2b6f59a1bc80548c37326936e46f81cdd4e4fadee05ef56a302a5937c
|
|
@@ -107,45 +107,24 @@ wgs84_lat_lon(int argc, VALUE *argv, VALUE klass)
|
|
|
107
107
|
if (argc == 2) {
|
|
108
108
|
lat = wgs84_get_value(argv[0]);
|
|
109
109
|
lon = wgs84_get_value(argv[1]);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
lat = wgs84_get_value(rb_ary_entry(tmp, 0));
|
|
115
|
-
lon = wgs84_get_value(rb_ary_entry(tmp, 1));
|
|
116
|
-
} else {
|
|
110
|
+
return rb_ary_new3(2L, rb_float_new(lat), rb_float_new(lon));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (argc != 1) {
|
|
117
114
|
rb_raise(rb_eArgError, "wrong number of arguments");
|
|
118
115
|
return Qnil;
|
|
119
116
|
}
|
|
120
117
|
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
static VALUE
|
|
126
|
-
wgs84_lat_lon_dms(int argc, VALUE *argv, VALUE klass)
|
|
127
|
-
{
|
|
128
|
-
double lat, lon;
|
|
129
|
-
char lat_buf[64], lon_buf[64];
|
|
130
|
-
VALUE tmp;
|
|
131
|
-
|
|
132
|
-
if (argc == 2) {
|
|
133
|
-
lat = wgs84_get_value(argv[0]);
|
|
134
|
-
lon = wgs84_get_value(argv[1]);
|
|
135
|
-
} else if (argc == 1 && TYPE(*argv) == T_ARRAY && RARRAY_LEN(*argv) == 2) {
|
|
118
|
+
if (TYPE(*argv) == T_ARRAY && RARRAY_LEN(*argv) == 2) {
|
|
136
119
|
lat = wgs84_get_value(rb_ary_entry(*argv, 0));
|
|
137
120
|
lon = wgs84_get_value(rb_ary_entry(*argv, 1));
|
|
138
|
-
|
|
139
|
-
lat = wgs84_get_value(rb_ary_entry(tmp, 0));
|
|
140
|
-
lon = wgs84_get_value(rb_ary_entry(tmp, 1));
|
|
141
|
-
} else {
|
|
142
|
-
rb_raise(rb_eArgError, "wrong number of arguments");
|
|
143
|
-
return Qnil;
|
|
121
|
+
return rb_ary_new3(2L, rb_float_new(lat), rb_float_new(lon));
|
|
144
122
|
}
|
|
145
123
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
124
|
+
tmp = rb_funcall(*argv, rb_intern("to_lat_lon"), 0);
|
|
125
|
+
lat = wgs84_get_value(rb_ary_entry(tmp, 0));
|
|
126
|
+
lon = wgs84_get_value(rb_ary_entry(tmp, 1));
|
|
127
|
+
return rb_ary_new3(2L, rb_float_new(lat), rb_float_new(lon));
|
|
149
128
|
}
|
|
150
129
|
|
|
151
130
|
|
|
@@ -281,7 +260,6 @@ Init_geodesic_wgs84(void)
|
|
|
281
260
|
rb_define_method(cWGS84, "as_deg", wgs84_as_deg, 1);
|
|
282
261
|
rb_define_method(cWGS84, "as_dms", wgs84_as_dms, 1);
|
|
283
262
|
rb_define_method(cWGS84, "lat_lon", wgs84_lat_lon, -1);
|
|
284
|
-
rb_define_method(cWGS84, "lat_lon_dms", wgs84_lat_lon_dms, -1);
|
|
285
263
|
rb_define_method(cWGS84, "distance", wgs84_distance, -1);
|
|
286
264
|
rb_define_method(cWGS84, "average", wgs84_average, 2);
|
|
287
265
|
rb_define_method(cWGS84, "center", wgs84_center, 2);
|
data/spec/geodesic_wgs84_spec.rb
CHANGED
|
@@ -10,15 +10,15 @@ class TestGeodesicWgs84 < MiniTest::Test
|
|
|
10
10
|
assert_equal 50.833833, @wgs84.as_deg(50.833833)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def
|
|
13
|
+
def test_as_deg
|
|
14
14
|
assert_equal 50.833833, @wgs84.as_deg("50 50 01.8")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def
|
|
17
|
+
def test_deg_as
|
|
18
18
|
assert_equal "50 50 1.8", @wgs84.as_dms(50.833833)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def test_as
|
|
22
22
|
assert_equal "50 50 1.8", @wgs84.as_dms("50 50 01.8")
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -34,60 +34,56 @@ class TestGeodesicWgs84 < MiniTest::Test
|
|
|
34
34
|
assert_equal [3.5, 4.123], @wgs84.lat_lon(["3.5", "4.123"])
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
def
|
|
38
|
-
assert_equal [
|
|
37
|
+
def test_lat_lon_alsfeld
|
|
38
|
+
assert_equal [50.751778, 9.251861], @wgs84.lat_lon("50 45 6.4", "9 15 6.7")
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def
|
|
42
|
-
assert_equal [
|
|
41
|
+
def test_lat_lon_vilbel
|
|
42
|
+
assert_equal [50.192028, 8.734722], @wgs84.lat_lon("50 11 31.3", "8 44 5.0")
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def
|
|
46
|
-
assert_equal [
|
|
45
|
+
def test_lat_lon_butzbach
|
|
46
|
+
assert_equal [50.427417, 8.680056], @wgs84.lat_lon("50 25 38.7", "8 40 48.2")
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def
|
|
50
|
-
assert_equal [
|
|
49
|
+
def test_lat_lon_gilserberg
|
|
50
|
+
assert_equal [50.946111, 9.070972], @wgs84.lat_lon("50 56 46.0", "9 4 15.5")
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
def
|
|
54
|
-
assert_equal [
|
|
53
|
+
def test_lat_lon_gruenberg
|
|
54
|
+
assert_equal [50.609694, 8.904167], @wgs84.lat_lon("50 36 34.9", "8 54 15.0")
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
def
|
|
58
|
-
assert_equal [
|
|
57
|
+
def test_lat_lon_haiger
|
|
58
|
+
assert_equal [50.761806, 8.156833], @wgs84.lat_lon("50 45 42.5", "8 9 24.6")
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def
|
|
62
|
-
assert_equal [
|
|
61
|
+
def test_lat_lon_herborn
|
|
62
|
+
assert_equal [50.670333, 8.258556], @wgs84.lat_lon("50 40 13.2", "8 15 30.8")
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def
|
|
66
|
-
assert_equal [
|
|
65
|
+
def test_lat_lon_homberg
|
|
66
|
+
assert_equal [50.743639, 9.019222], @wgs84.lat_lon("50 44 37.1", "9 1 9.2")
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
def
|
|
70
|
-
assert_equal [
|
|
69
|
+
def test_lat_lon_limburg
|
|
70
|
+
assert_equal [50.405778, 8.082222], @wgs84.lat_lon("50 24 20.8", "8 4 56.0")
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
def
|
|
74
|
-
assert_equal [
|
|
73
|
+
def test_lat_lon_marburg
|
|
74
|
+
assert_equal [50.833833, 8.769333], @wgs84.lat_lon("50 50 1.8", "8 46 9.6")
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
def
|
|
78
|
-
assert_equal [
|
|
77
|
+
def test_lat_lon_pohlheim
|
|
78
|
+
assert_equal [50.536833, 8.7125], @wgs84.lat_lon("50 32 12.6", "8 42 45.0")
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
def
|
|
82
|
-
assert_equal [
|
|
81
|
+
def test_lat_lon_siegen
|
|
82
|
+
assert_equal [50.853028, 8.000667], @wgs84.lat_lon("50 51 10.9", "8 0 2.4")
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
def
|
|
86
|
-
assert_equal [
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def test_lat_lon_dms_wetzlar
|
|
90
|
-
assert_equal ["50 33 13.6", "8 29 32.2"], @wgs84.lat_lon_dms(50.553778, 8.492278)
|
|
85
|
+
def test_lat_lon_wetzlar
|
|
86
|
+
assert_equal [50.553778, 8.492278], @wgs84.lat_lon("50 33 13.6", "8 29 32.2")
|
|
91
87
|
end
|
|
92
88
|
end
|
|
93
89
|
|