proj4rb 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +26 -15
- data/README.rdoc +82 -44
- data/Rakefile +27 -27
- data/lib/api/api.rb +96 -118
- data/lib/api/api_5_0.rb +331 -300
- data/lib/api/api_5_1.rb +6 -6
- data/lib/api/api_5_2.rb +4 -4
- data/lib/api/api_6_0.rb +116 -14
- data/lib/api/api_6_1.rb +4 -4
- data/lib/api/api_6_2.rb +9 -6
- data/lib/api/api_6_3.rb +6 -0
- data/lib/api/api_7_0.rb +68 -0
- data/lib/api/api_7_1.rb +73 -0
- data/lib/api/api_7_2.rb +14 -0
- data/lib/api/api_8_0.rb +6 -0
- data/lib/api/api_8_1.rb +24 -0
- data/lib/api/api_8_2.rb +6 -0
- data/lib/api/api_9_1.rb +7 -0
- data/lib/api/api_9_2.rb +9 -0
- data/lib/api/api_experimental.rb +196 -0
- data/lib/proj/area.rb +73 -32
- data/lib/proj/axis_info.rb +44 -0
- data/lib/proj/bounds.rb +13 -0
- data/lib/proj/context.rb +174 -28
- data/lib/proj/conversion.rb +92 -0
- data/lib/proj/coordinate.rb +281 -197
- data/lib/proj/coordinate_operation_mixin.rb +381 -0
- data/lib/proj/coordinate_system.rb +137 -0
- data/lib/proj/crs.rb +672 -204
- data/lib/proj/crs_info.rb +47 -0
- data/lib/proj/database.rb +305 -0
- data/lib/proj/datum.rb +32 -0
- data/lib/proj/datum_ensemble.rb +34 -0
- data/lib/proj/ellipsoid.rb +77 -41
- data/lib/proj/error.rb +62 -9
- data/lib/proj/file_api.rb +166 -0
- data/lib/proj/grid.rb +121 -0
- data/lib/proj/grid_cache.rb +64 -0
- data/lib/proj/grid_info.rb +19 -0
- data/lib/proj/network_api.rb +92 -0
- data/lib/proj/operation.rb +42 -42
- data/lib/proj/operation_factory_context.rb +136 -0
- data/lib/proj/parameter.rb +38 -0
- data/lib/proj/parameters.rb +106 -0
- data/lib/proj/pj_object.rb +670 -80
- data/lib/proj/pj_objects.rb +44 -0
- data/lib/proj/prime_meridian.rb +65 -39
- data/lib/proj/projection.rb +698 -207
- data/lib/proj/session.rb +46 -0
- data/lib/proj/strings.rb +32 -0
- data/lib/proj/transformation.rb +101 -60
- data/lib/proj/unit.rb +108 -53
- data/lib/proj.rb +110 -9
- data/proj4rb.gemspec +5 -5
- data/test/abstract_test.rb +23 -1
- data/test/context_test.rb +172 -82
- data/test/conversion_test.rb +368 -0
- data/test/coordinate_system_test.rb +144 -0
- data/test/crs_test.rb +770 -71
- data/test/database_test.rb +360 -0
- data/test/datum_ensemble_test.rb +65 -0
- data/test/datum_test.rb +55 -0
- data/test/ellipsoid_test.rb +64 -18
- data/test/file_api_test.rb +66 -0
- data/test/grid_cache_test.rb +72 -0
- data/test/grid_test.rb +141 -0
- data/test/network_api_test.rb +45 -0
- data/test/operation_factory_context_test.rb +201 -0
- data/test/parameters_test.rb +40 -0
- data/test/pj_object_test.rb +179 -0
- data/test/prime_meridian_test.rb +76 -0
- data/test/proj_test.rb +46 -4
- data/test/projection_test.rb +646 -222
- data/test/session_test.rb +78 -0
- data/test/transformation_test.rb +149 -7
- data/test/unit_test.rb +57 -28
- metadata +51 -13
- data/lib/api/api_4_9.rb +0 -31
- data/lib/proj/config.rb +0 -70
- data/lib/proj/point.rb +0 -72
- data/test/prime_meridians_test.rb +0 -33
@@ -0,0 +1,144 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative './abstract_test'
|
4
|
+
|
5
|
+
class CoordinateSystemTest < AbstractTest
|
6
|
+
def test_create
|
7
|
+
context = Proj::Context.new
|
8
|
+
crs = Proj::Crs.new('EPSG:4326', context)
|
9
|
+
cs = crs.coordinate_system
|
10
|
+
axes = cs.axes
|
11
|
+
cs = Proj::CoordinateSystem.create(cs.type, axes, context)
|
12
|
+
assert_equal(2, cs.axis_count)
|
13
|
+
assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
|
14
|
+
assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
|
15
|
+
refute(cs.auth_name)
|
16
|
+
refute(cs.id_code)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_create_ellipsoidal_2d
|
20
|
+
context = Proj::Context.new
|
21
|
+
cs = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LONGITUDE_LATITUDE, context)
|
22
|
+
assert_equal(2, cs.axis_count)
|
23
|
+
assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
|
24
|
+
assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
|
25
|
+
refute(cs.auth_name)
|
26
|
+
refute(cs.id_code)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_create_ellipsoidal_3d
|
30
|
+
context = Proj::Context.new
|
31
|
+
cs = Proj::CoordinateSystem.create_ellipsoidal_3d(:PJ_ELLPS3D_LATITUDE_LONGITUDE_HEIGHT, context)
|
32
|
+
assert_equal(3, cs.axis_count)
|
33
|
+
assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
|
34
|
+
assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
|
35
|
+
|
36
|
+
axis = cs.axis_info(0)
|
37
|
+
assert_equal("Latitude", axis.name)
|
38
|
+
assert_equal("lat", axis.abbreviation)
|
39
|
+
assert_equal("north", axis.direction)
|
40
|
+
assert_equal("degree", axis.unit_name)
|
41
|
+
assert_in_delta(0.017453292519943295, axis.unit_conv_factor)
|
42
|
+
|
43
|
+
axis = cs.axis_info(1)
|
44
|
+
assert_equal("Longitude", axis.name)
|
45
|
+
assert_equal("lon", axis.abbreviation)
|
46
|
+
assert_equal("east", axis.direction)
|
47
|
+
assert_equal("degree", axis.unit_name)
|
48
|
+
assert_in_delta(0.017453292519943295, axis.unit_conv_factor)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_create_ellipsoidal_3d_custom_units
|
52
|
+
context = Proj::Context.new
|
53
|
+
cs = Proj::CoordinateSystem.create_ellipsoidal_3d(:PJ_ELLPS3D_LATITUDE_LONGITUDE_HEIGHT, context,
|
54
|
+
horizontal_angular_unit_name: "foo", horizontal_angular_unit_conv_factor: 0.5,
|
55
|
+
vertical_linear_unit_name: "bar", vertical_linear_unit_conv_factor: 0.6)
|
56
|
+
assert_equal(3, cs.axis_count)
|
57
|
+
assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
|
58
|
+
assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
|
59
|
+
|
60
|
+
axis = cs.axis_info(0)
|
61
|
+
assert_equal("Latitude", axis.name)
|
62
|
+
assert_equal("lat", axis.abbreviation)
|
63
|
+
assert_equal("north", axis.direction)
|
64
|
+
assert_equal("foo", axis.unit_name)
|
65
|
+
assert_equal(0.5, axis.unit_conv_factor)
|
66
|
+
|
67
|
+
axis = cs.axis_info(1)
|
68
|
+
assert_equal("Longitude", axis.name)
|
69
|
+
assert_equal("lon", axis.abbreviation)
|
70
|
+
assert_equal("east", axis.direction)
|
71
|
+
assert_equal("foo", axis.unit_name)
|
72
|
+
assert_equal(0.5, axis.unit_conv_factor)
|
73
|
+
|
74
|
+
axis = cs.axis_info(2)
|
75
|
+
assert_equal("Ellipsoidal height", axis.name)
|
76
|
+
assert_equal("h", axis.abbreviation)
|
77
|
+
assert_equal("up", axis.direction)
|
78
|
+
assert_equal("bar", axis.unit_name)
|
79
|
+
assert_equal(0.6, axis.unit_conv_factor)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_create_cartesian
|
83
|
+
context = Proj::Context.new
|
84
|
+
coordinate_system = Proj::CoordinateSystem.create_cartesian_2d(context, :PJ_CART2D_EASTING_NORTHING)
|
85
|
+
assert_equal(2, coordinate_system.axis_count)
|
86
|
+
assert_equal(:PJ_CS_TYPE_CARTESIAN, coordinate_system.type)
|
87
|
+
assert_equal(:PJ_TYPE_UNKNOWN, coordinate_system.proj_type)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_type
|
91
|
+
crs = Proj::Crs.new('EPSG:4326')
|
92
|
+
cs = crs.coordinate_system
|
93
|
+
refute(cs.name)
|
94
|
+
assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
|
95
|
+
assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
|
96
|
+
assert_equal("EPSG", cs.auth_name)
|
97
|
+
assert_equal("6422", cs.id_code)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_axis_count
|
101
|
+
crs = Proj::Crs.new('EPSG:4326')
|
102
|
+
cs = crs.coordinate_system
|
103
|
+
assert_equal(2, cs.axis_count)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_axis_info
|
107
|
+
crs = Proj::Crs.new('EPSG:4326')
|
108
|
+
cs = crs.coordinate_system
|
109
|
+
axis_info = cs.axis_info(0)
|
110
|
+
|
111
|
+
assert_equal("Geodetic latitude", axis_info.name)
|
112
|
+
assert_equal("Lat", axis_info.abbreviation)
|
113
|
+
assert_equal("north", axis_info.direction)
|
114
|
+
assert_equal(0.017453292519943295, axis_info.unit_conv_factor)
|
115
|
+
assert_equal("degree", axis_info.unit_name)
|
116
|
+
assert_equal("EPSG", axis_info.unit_auth_name)
|
117
|
+
assert_equal("9122", axis_info.unit_code)
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_axes
|
121
|
+
crs = Proj::Crs.new('EPSG:4326')
|
122
|
+
cs = crs.coordinate_system
|
123
|
+
axes = cs.axes
|
124
|
+
assert_equal(2, axes.count)
|
125
|
+
|
126
|
+
axis_info = axes[0]
|
127
|
+
assert_equal("Geodetic latitude", axis_info.name)
|
128
|
+
assert_equal("Lat", axis_info.abbreviation)
|
129
|
+
assert_equal("north", axis_info.direction)
|
130
|
+
assert_equal(0.017453292519943295, axis_info.unit_conv_factor)
|
131
|
+
assert_equal("degree", axis_info.unit_name)
|
132
|
+
assert_equal("EPSG", axis_info.unit_auth_name)
|
133
|
+
assert_equal("9122", axis_info.unit_code)
|
134
|
+
|
135
|
+
axis_info = axes[1]
|
136
|
+
assert_equal("Geodetic longitude", axis_info.name)
|
137
|
+
assert_equal("Lon", axis_info.abbreviation)
|
138
|
+
assert_equal("east", axis_info.direction)
|
139
|
+
assert_equal(0.017453292519943295, axis_info.unit_conv_factor)
|
140
|
+
assert_equal("degree", axis_info.unit_name)
|
141
|
+
assert_equal("EPSG", axis_info.unit_auth_name)
|
142
|
+
assert_equal("9122", axis_info.unit_code)
|
143
|
+
end
|
144
|
+
end
|