proj4rb 4.1.1 → 5.0.0
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/CHANGELOG.md +98 -0
- data/Gemfile +4 -4
- data/README.md +53 -0
- data/lib/api/proj.rb +750 -0
- data/lib/api/proj_experimental.rb +7 -0
- data/lib/api/proj_ffi.rb +47 -0
- data/lib/api/proj_version.rb +26 -0
- data/lib/examples/axis_order_normalization.rb +13 -0
- data/lib/examples/batch_transformation.rb +25 -0
- data/lib/examples/context_logging.rb +26 -0
- data/lib/examples/crs_identification.rb +18 -0
- data/lib/examples/database_query.rb +27 -0
- data/lib/examples/geodetic_distance.rb +38 -0
- data/lib/examples/geodetic_to_projected.rb +18 -0
- data/lib/examples/operation_factory_context.rb +19 -0
- data/lib/examples/pipeline_operator.rb +21 -0
- data/lib/examples/promote_demote_3d.rb +23 -0
- data/lib/examples/serialization_formats.rb +17 -0
- data/lib/examples/transform_bounds.rb +18 -0
- data/lib/examples/transformation_with_area.rb +18 -0
- data/lib/proj/area.rb +74 -74
- data/lib/proj/axis_info.rb +44 -44
- data/lib/proj/bounds.rb +22 -0
- data/lib/proj/bounds3d.rb +45 -0
- data/lib/proj/context.rb +57 -23
- data/lib/proj/conversion.rb +94 -91
- data/lib/proj/coordinate.rb +304 -281
- data/lib/proj/coordinate_metadata.rb +38 -38
- data/lib/proj/coordinate_operation_mixin.rb +464 -381
- data/lib/proj/coordinate_system.rb +143 -137
- data/lib/proj/crs.rb +688 -680
- data/lib/proj/crs_info.rb +47 -47
- data/lib/proj/database.rb +310 -305
- data/lib/proj/datum.rb +32 -32
- data/lib/proj/datum_ensemble.rb +34 -34
- data/lib/proj/domain.rb +82 -0
- data/lib/proj/ellipsoid.rb +77 -77
- data/lib/proj/error.rb +7 -8
- data/lib/proj/file_api_callbacks.rb +165 -0
- data/lib/proj/grid.rb +121 -121
- data/lib/proj/grid_cache.rb +65 -64
- data/lib/proj/grid_info.rb +19 -19
- data/lib/proj/life_span.rb +21 -0
- data/lib/proj/network_api_callbacks.rb +86 -0
- data/lib/proj/operation.rb +66 -42
- data/lib/proj/operation_factory_context.rb +4 -2
- data/lib/proj/options.rb +41 -0
- data/lib/proj/parameter.rb +37 -37
- data/lib/proj/parameters.rb +106 -107
- data/lib/proj/pj_axis_description.rb +26 -0
- data/lib/proj/pj_object.rb +602 -672
- data/lib/proj/pj_objects.rb +45 -45
- data/lib/proj/pj_param_description.rb +28 -0
- data/lib/proj/prime_meridian.rb +65 -65
- data/lib/proj/projection.rb +54 -25
- data/lib/proj/session.rb +2 -0
- data/lib/proj/transformation.rb +102 -102
- data/lib/proj/unit.rb +81 -108
- data/lib/proj.rb +10 -3
- data/lib/proj4.rb +5 -5
- data/proj4rb.gemspec +10 -5
- data/test/abstract_test.rb +7 -5
- data/test/context_test.rb +210 -172
- data/test/context_validation_test.rb +11 -0
- data/test/conversion_test.rb +376 -368
- data/test/coordinate_metadata_test.rb +34 -0
- data/test/coordinate_system_test.rb +162 -144
- data/test/coordinate_test.rb +289 -34
- data/test/crs_test.rb +1112 -1082
- data/test/database_test.rb +407 -391
- data/test/datum_ensemble_test.rb +64 -64
- data/test/datum_test.rb +61 -54
- data/test/domain_test.rb +72 -0
- data/test/ellipsoid_test.rb +80 -80
- data/test/examples_test.rb +149 -0
- data/test/file_api_example.rb +58 -0
- data/test/file_api_test.rb +74 -66
- data/test/grid_cache_test.rb +72 -72
- data/test/grid_test.rb +126 -141
- data/test/network_api_example.rb +48 -0
- data/test/network_api_test.rb +33 -45
- data/test/operation_factory_context_test.rb +225 -205
- data/test/operation_test.rb +40 -29
- data/test/options_test.rb +17 -0
- data/test/parameters_test.rb +86 -40
- data/test/pj_object_test.rb +221 -187
- data/test/prime_meridian_test.rb +75 -75
- data/test/proj_test.rb +58 -58
- data/test/projection_test.rb +680 -650
- data/test/session_test.rb +78 -77
- data/test/transformation_test.rb +238 -210
- data/test/unit_test.rb +114 -76
- metadata +44 -32
- data/ChangeLog +0 -94
- data/README.rdoc +0 -189
- data/lib/api/api.rb +0 -117
- data/lib/api/api_5_0.rb +0 -338
- data/lib/api/api_5_1.rb +0 -7
- data/lib/api/api_5_2.rb +0 -5
- data/lib/api/api_6_0.rb +0 -146
- data/lib/api/api_6_1.rb +0 -5
- data/lib/api/api_6_2.rb +0 -10
- data/lib/api/api_6_3.rb +0 -6
- data/lib/api/api_7_0.rb +0 -69
- data/lib/api/api_7_1.rb +0 -73
- data/lib/api/api_7_2.rb +0 -14
- data/lib/api/api_8_0.rb +0 -6
- data/lib/api/api_8_1.rb +0 -24
- data/lib/api/api_8_2.rb +0 -6
- data/lib/api/api_9_1.rb +0 -7
- data/lib/api/api_9_2.rb +0 -9
- data/lib/api/api_9_4.rb +0 -6
- data/lib/api/api_experimental.rb +0 -201
- data/lib/proj/file_api.rb +0 -166
- data/lib/proj/network_api.rb +0 -92
data/test/unit_test.rb
CHANGED
|
@@ -1,76 +1,114 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
|
|
3
|
-
require_relative './abstract_test'
|
|
4
|
-
|
|
5
|
-
class UnitsTest < AbstractTest
|
|
6
|
-
def test_get_all
|
|
7
|
-
database = Proj::Database.new(Proj::Context.current)
|
|
8
|
-
units = database.units
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
assert_equal(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
assert_equal('
|
|
49
|
-
assert_equal('
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
end
|
|
76
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require_relative './abstract_test'
|
|
4
|
+
|
|
5
|
+
class UnitsTest < AbstractTest
|
|
6
|
+
def test_get_all
|
|
7
|
+
database = Proj::Database.new(Proj::Context.current)
|
|
8
|
+
units = database.units
|
|
9
|
+
expected = case
|
|
10
|
+
when Proj::Api::PROJ_VERSION >= Gem::Version.new('9.8.0')
|
|
11
|
+
106
|
|
12
|
+
else
|
|
13
|
+
91
|
|
14
|
+
end
|
|
15
|
+
assert_equal(expected, units.count)
|
|
16
|
+
|
|
17
|
+
unit = units[0]
|
|
18
|
+
assert_instance_of(Proj::Unit, unit)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_builtin
|
|
22
|
+
units = Proj::Unit.built_in
|
|
23
|
+
expected = case
|
|
24
|
+
when Proj::Api::PROJ_VERSION >= Gem::Version.new('9.8.0')
|
|
25
|
+
106
|
|
26
|
+
else
|
|
27
|
+
91
|
|
28
|
+
end
|
|
29
|
+
assert_equal(expected, units.count)
|
|
30
|
+
|
|
31
|
+
unit = units[0]
|
|
32
|
+
assert_instance_of(Proj::Unit, unit)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_linear_unit
|
|
36
|
+
database = Proj::Database.new(Proj::Context.current)
|
|
37
|
+
units = database.units(category: "linear")
|
|
38
|
+
expected = case
|
|
39
|
+
when Proj::Api::PROJ_VERSION >= Gem::Version.new('9.8.0')
|
|
40
|
+
67
|
|
41
|
+
else
|
|
42
|
+
52
|
|
43
|
+
end
|
|
44
|
+
assert_equal(expected, units.count)
|
|
45
|
+
|
|
46
|
+
unit = units[0]
|
|
47
|
+
assert_instance_of(Proj::Unit, unit)
|
|
48
|
+
assert_equal('millimetre', unit.name)
|
|
49
|
+
assert_equal('millimetre', unit.to_s)
|
|
50
|
+
assert_equal('mm', unit.proj_short_name)
|
|
51
|
+
assert_equal(0.001, unit.conv_factor)
|
|
52
|
+
assert_equal('EPSG', unit.auth_name)
|
|
53
|
+
assert_equal('#<Proj::Unit authority="EPSG", code="1025", name="millimetre">', unit.inspect)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_angular_unit
|
|
57
|
+
database = Proj::Database.new(Proj::Context.current)
|
|
58
|
+
units = database.units(category: "angular")
|
|
59
|
+
assert_equal(22, units.count)
|
|
60
|
+
|
|
61
|
+
unit = units[0]
|
|
62
|
+
assert_equal('milliarc-second', unit.name)
|
|
63
|
+
assert_equal('milliarc-second', unit.to_s)
|
|
64
|
+
refute(unit.proj_short_name)
|
|
65
|
+
assert_in_delta(4.84813681109536e-09, unit.conv_factor, 0.0001)
|
|
66
|
+
assert_equal('EPSG', unit.auth_name)
|
|
67
|
+
assert_equal('#<Proj::Unit authority="EPSG", code="1031", name="milliarc-second">', unit.inspect)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def test_compare
|
|
71
|
+
database = Proj::Database.new(Proj::Context.current)
|
|
72
|
+
unit_1 = database.unit("EPSG", "9001")
|
|
73
|
+
unit_2 = database.unit("EPSG", "9001")
|
|
74
|
+
assert(unit_1 == unit_2)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_category
|
|
78
|
+
database = Proj::Database.new(Proj::Context.current)
|
|
79
|
+
|
|
80
|
+
%w[linear linear_per_time angular angular_per_time scale scale_per_time time].each do |category|
|
|
81
|
+
units = database.units(category: category)
|
|
82
|
+
refute_empty(units)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_auth_name
|
|
87
|
+
database = Proj::Database.new(Proj::Context.current)
|
|
88
|
+
|
|
89
|
+
%w[EPSG PROJ].each do |auth_name|
|
|
90
|
+
units = database.units(auth_name: auth_name)
|
|
91
|
+
refute_empty(units)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test_unit_type
|
|
96
|
+
database = Proj::Database.new(Proj::Context.current)
|
|
97
|
+
|
|
98
|
+
expected = {
|
|
99
|
+
"linear" => :PJ_UT_LINEAR,
|
|
100
|
+
"linear_per_time" => :PJ_UT_LINEAR,
|
|
101
|
+
"angular" => :PJ_UT_ANGULAR,
|
|
102
|
+
"angular_per_time" => :PJ_UT_ANGULAR,
|
|
103
|
+
"scale" => :PJ_UT_SCALE,
|
|
104
|
+
"scale_per_time" => :PJ_UT_SCALE,
|
|
105
|
+
"time" => :PJ_UT_TIME
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
expected.each do |category, unit_type|
|
|
109
|
+
units = database.units(category: category)
|
|
110
|
+
refute_empty(units, "No units found for category: #{category}")
|
|
111
|
+
assert_equal(unit_type, units.first.unit_type)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
metadata
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: proj4rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Guilhem Vellut
|
|
8
8
|
- Jochen Topf
|
|
9
9
|
- Charlie Savage
|
|
10
|
-
autorequire:
|
|
11
10
|
bindir: bin
|
|
12
11
|
cert_chain: []
|
|
13
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
14
13
|
dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
|
16
15
|
name: ffi
|
|
@@ -18,14 +17,14 @@ dependencies:
|
|
|
18
17
|
requirements:
|
|
19
18
|
- - ">="
|
|
20
19
|
- !ruby/object:Gem::Version
|
|
21
|
-
version:
|
|
20
|
+
version: 1.17.4
|
|
22
21
|
type: :runtime
|
|
23
22
|
prerelease: false
|
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
24
|
requirements:
|
|
26
25
|
- - ">="
|
|
27
26
|
- !ruby/object:Gem::Version
|
|
28
|
-
version:
|
|
27
|
+
version: 1.17.4
|
|
29
28
|
- !ruby/object:Gem::Dependency
|
|
30
29
|
name: bundler
|
|
31
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -83,38 +82,37 @@ dependencies:
|
|
|
83
82
|
- !ruby/object:Gem::Version
|
|
84
83
|
version: '0'
|
|
85
84
|
description: " Ruby bindings for the Proj coordinate transformation library\n"
|
|
86
|
-
email:
|
|
87
85
|
executables: []
|
|
88
86
|
extensions: []
|
|
89
87
|
extra_rdoc_files: []
|
|
90
88
|
files:
|
|
91
|
-
-
|
|
89
|
+
- CHANGELOG.md
|
|
92
90
|
- Gemfile
|
|
93
91
|
- MIT-LICENSE
|
|
94
|
-
- README.
|
|
92
|
+
- README.md
|
|
95
93
|
- Rakefile
|
|
96
|
-
- lib/api/
|
|
97
|
-
- lib/api/
|
|
98
|
-
- lib/api/
|
|
99
|
-
- lib/api/
|
|
100
|
-
- lib/
|
|
101
|
-
- lib/
|
|
102
|
-
- lib/
|
|
103
|
-
- lib/
|
|
104
|
-
- lib/
|
|
105
|
-
- lib/
|
|
106
|
-
- lib/
|
|
107
|
-
- lib/
|
|
108
|
-
- lib/
|
|
109
|
-
- lib/
|
|
110
|
-
- lib/
|
|
111
|
-
- lib/
|
|
112
|
-
- lib/
|
|
113
|
-
- lib/api/api_experimental.rb
|
|
94
|
+
- lib/api/proj.rb
|
|
95
|
+
- lib/api/proj_experimental.rb
|
|
96
|
+
- lib/api/proj_ffi.rb
|
|
97
|
+
- lib/api/proj_version.rb
|
|
98
|
+
- lib/examples/axis_order_normalization.rb
|
|
99
|
+
- lib/examples/batch_transformation.rb
|
|
100
|
+
- lib/examples/context_logging.rb
|
|
101
|
+
- lib/examples/crs_identification.rb
|
|
102
|
+
- lib/examples/database_query.rb
|
|
103
|
+
- lib/examples/geodetic_distance.rb
|
|
104
|
+
- lib/examples/geodetic_to_projected.rb
|
|
105
|
+
- lib/examples/operation_factory_context.rb
|
|
106
|
+
- lib/examples/pipeline_operator.rb
|
|
107
|
+
- lib/examples/promote_demote_3d.rb
|
|
108
|
+
- lib/examples/serialization_formats.rb
|
|
109
|
+
- lib/examples/transform_bounds.rb
|
|
110
|
+
- lib/examples/transformation_with_area.rb
|
|
114
111
|
- lib/proj.rb
|
|
115
112
|
- lib/proj/area.rb
|
|
116
113
|
- lib/proj/axis_info.rb
|
|
117
114
|
- lib/proj/bounds.rb
|
|
115
|
+
- lib/proj/bounds3d.rb
|
|
118
116
|
- lib/proj/context.rb
|
|
119
117
|
- lib/proj/conversion.rb
|
|
120
118
|
- lib/proj/coordinate.rb
|
|
@@ -126,19 +124,24 @@ files:
|
|
|
126
124
|
- lib/proj/database.rb
|
|
127
125
|
- lib/proj/datum.rb
|
|
128
126
|
- lib/proj/datum_ensemble.rb
|
|
127
|
+
- lib/proj/domain.rb
|
|
129
128
|
- lib/proj/ellipsoid.rb
|
|
130
129
|
- lib/proj/error.rb
|
|
131
|
-
- lib/proj/
|
|
130
|
+
- lib/proj/file_api_callbacks.rb
|
|
132
131
|
- lib/proj/grid.rb
|
|
133
132
|
- lib/proj/grid_cache.rb
|
|
134
133
|
- lib/proj/grid_info.rb
|
|
135
|
-
- lib/proj/
|
|
134
|
+
- lib/proj/life_span.rb
|
|
135
|
+
- lib/proj/network_api_callbacks.rb
|
|
136
136
|
- lib/proj/operation.rb
|
|
137
137
|
- lib/proj/operation_factory_context.rb
|
|
138
|
+
- lib/proj/options.rb
|
|
138
139
|
- lib/proj/parameter.rb
|
|
139
140
|
- lib/proj/parameters.rb
|
|
141
|
+
- lib/proj/pj_axis_description.rb
|
|
140
142
|
- lib/proj/pj_object.rb
|
|
141
143
|
- lib/proj/pj_objects.rb
|
|
144
|
+
- lib/proj/pj_param_description.rb
|
|
142
145
|
- lib/proj/prime_meridian.rb
|
|
143
146
|
- lib/proj/projection.rb
|
|
144
147
|
- lib/proj/session.rb
|
|
@@ -149,20 +152,27 @@ files:
|
|
|
149
152
|
- proj4rb.gemspec
|
|
150
153
|
- test/abstract_test.rb
|
|
151
154
|
- test/context_test.rb
|
|
155
|
+
- test/context_validation_test.rb
|
|
152
156
|
- test/conversion_test.rb
|
|
157
|
+
- test/coordinate_metadata_test.rb
|
|
153
158
|
- test/coordinate_system_test.rb
|
|
154
159
|
- test/coordinate_test.rb
|
|
155
160
|
- test/crs_test.rb
|
|
156
161
|
- test/database_test.rb
|
|
157
162
|
- test/datum_ensemble_test.rb
|
|
158
163
|
- test/datum_test.rb
|
|
164
|
+
- test/domain_test.rb
|
|
159
165
|
- test/ellipsoid_test.rb
|
|
166
|
+
- test/examples_test.rb
|
|
167
|
+
- test/file_api_example.rb
|
|
160
168
|
- test/file_api_test.rb
|
|
161
169
|
- test/grid_cache_test.rb
|
|
162
170
|
- test/grid_test.rb
|
|
171
|
+
- test/network_api_example.rb
|
|
163
172
|
- test/network_api_test.rb
|
|
164
173
|
- test/operation_factory_context_test.rb
|
|
165
174
|
- test/operation_test.rb
|
|
175
|
+
- test/options_test.rb
|
|
166
176
|
- test/parameters_test.rb
|
|
167
177
|
- test/pj_object_test.rb
|
|
168
178
|
- test/prime_meridian_test.rb
|
|
@@ -174,8 +184,11 @@ files:
|
|
|
174
184
|
homepage: https://github.com/cfis/proj4rb
|
|
175
185
|
licenses:
|
|
176
186
|
- MIT
|
|
177
|
-
metadata:
|
|
178
|
-
|
|
187
|
+
metadata:
|
|
188
|
+
homepage_uri: https://github.com/cfis/proj4rb
|
|
189
|
+
source_code_uri: https://github.com/cfis/proj4rb
|
|
190
|
+
changelog_uri: https://github.com/cfis/proj4rb/blob/master/CHANGELOG.md
|
|
191
|
+
documentation_uri: https://cfis.github.io/proj4rb/
|
|
179
192
|
rdoc_options: []
|
|
180
193
|
require_paths:
|
|
181
194
|
- lib
|
|
@@ -191,8 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
191
204
|
version: '0'
|
|
192
205
|
requirements:
|
|
193
206
|
- Proj Library
|
|
194
|
-
rubygems_version:
|
|
195
|
-
signing_key:
|
|
207
|
+
rubygems_version: 4.0.9
|
|
196
208
|
specification_version: 4
|
|
197
209
|
summary: Ruby bindings for the Proj coordinate transformation library
|
|
198
210
|
test_files: []
|
data/ChangeLog
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
4.1.1 - January 30, 2024
|
|
2
|
-
======================
|
|
3
|
-
* Update tests for Proj 9.3
|
|
4
|
-
* Initial support for CoordinateMetadata in Proj 9.4 (not released yet)
|
|
5
|
-
|
|
6
|
-
4.1.0 - March 12, 2023
|
|
7
|
-
======================
|
|
8
|
-
* Fix YARD warnings
|
|
9
|
-
* Fix YARD types to match RBS types
|
|
10
|
-
* Don't use type as attribute or method name to avoid conflicts with RBS
|
|
11
|
-
|
|
12
|
-
4.0.0 - March 12, 2023
|
|
13
|
-
======================
|
|
14
|
-
* Support Proj 9
|
|
15
|
-
* Add support for missing APIs - the gem now provides almost 100% coverage
|
|
16
|
-
* Add support for Proj experimental APIs including the creation of projection conversions
|
|
17
|
-
* Add/updated support for a number of ISO 19111 classes, including PrimeMeridian, Ellipsoid,
|
|
18
|
-
Datum, DatumEnsemble, CoordinateOperation and Parameters
|
|
19
|
-
* Greatly improved documentation (https://rubydoc.info/github/cfis/proj4rb)
|
|
20
|
-
* Remove old Proj 4.9 support
|
|
21
|
-
* Note this release does have some API changes. These include the removal of Proj 4.9 Point and Coordinate classes, changes to the PrimeMeridian class and changes to the Ellipsoid class. These changes should not impact most users.
|
|
22
|
-
|
|
23
|
-
3.0.0 - September 26, 2021
|
|
24
|
-
=========================
|
|
25
|
-
* Support Proj 8 which removes the old Proj API (Charlie Savage)
|
|
26
|
-
* Support newer versions of FFI which remove support for returning strings from callbacks (Charlie Savage)
|
|
27
|
-
|
|
28
|
-
2.2.2 - January 10, 2020
|
|
29
|
-
=========================
|
|
30
|
-
* Move proj_context_set_autoclose_database to api 6.2 - Jan Klimke)
|
|
31
|
-
* Improve search path generation code (Charlie Savage)
|
|
32
|
-
|
|
33
|
-
2.2.1 - January 8, 2020
|
|
34
|
-
=========================
|
|
35
|
-
* Move proj_as_projjson from version 6.0 to 6.2 api (Charlie Savage)
|
|
36
|
-
* Improve search path generation code (Charlie Savage)
|
|
37
|
-
|
|
38
|
-
2.2.0 - January 7, 2020
|
|
39
|
-
=========================
|
|
40
|
-
* Fix broken gem - was not including all api files (Jan Klimke)
|
|
41
|
-
* Add paths on MacOS when using Brew (Jan Klimke)
|
|
42
|
-
* Various code cleanups (Charlie Savage)
|
|
43
|
-
|
|
44
|
-
2.1.0 - January 5, 2020
|
|
45
|
-
=========================
|
|
46
|
-
* Set Ruby 2.4.1 to be the minimum allowed version (Samuel Williams)
|
|
47
|
-
* Fix incorrect use of context, reduce warnings when running tests (Samuel Williams)
|
|
48
|
-
* Fix `bundle exec rake test` (Samuel Williams)
|
|
49
|
-
* Add 2.4.1 to the travis test matrix (Samuel Williams)
|
|
50
|
-
|
|
51
|
-
2.0.0 - December 30, 2019
|
|
52
|
-
=========================
|
|
53
|
-
- Full rewrite to support API changes in Proj versions 5 and 6 - Charlie Savage)
|
|
54
|
-
- As part of rewrite switch bindings to use FFI versus a C extension (Charlie Savage)
|
|
55
|
-
- Split Ruby code into multiple files based on classes (Charlie Savage)
|
|
56
|
-
- Add in a bunch of new classes including Context, Crs, Coordinate, Ellipsoid, Prime Meridian and Transform (Charlie Savage)
|
|
57
|
-
- Deprecate Projection and Point - these will stop working with Proj 7 since the use an older deprecated API (Charlie Savage)
|
|
58
|
-
|
|
59
|
-
1.0.0 - December 14, 2014
|
|
60
|
-
=========================
|
|
61
|
-
- Calling this 1.0.0 since its a very stable gem (Charlie Savage)
|
|
62
|
-
|
|
63
|
-
0.4.3 - August 30, 2011
|
|
64
|
-
=========================
|
|
65
|
-
- Remove reference to now private projects.h header
|
|
66
|
-
|
|
67
|
-
0.4.2 - August 15, 2011
|
|
68
|
-
=========================
|
|
69
|
-
- Minor build tweak to support MSVC++
|
|
70
|
-
|
|
71
|
-
0.4.1 - July 30, 2011
|
|
72
|
-
=========================
|
|
73
|
-
- Search first for binaries when using windows gems
|
|
74
|
-
- Add # encoding to test files
|
|
75
|
-
- Reformat tests files to use standard ruby 2 space indenting
|
|
76
|
-
|
|
77
|
-
0.4.0 - July 30, 2011
|
|
78
|
-
=========================
|
|
79
|
-
- Update to compile on Ruby 1.9.* (Fabio Renzo Panettieri)
|
|
80
|
-
- Add in gemspec file (Charlie Savage)
|
|
81
|
-
- Add rake-compiler as development dependency, remove older MinGW build system (Charlie Savage)
|
|
82
|
-
- Move to GitHub (Charlie Savage)
|
|
83
|
-
|
|
84
|
-
0.3.1 - December 23, 2009
|
|
85
|
-
=========================
|
|
86
|
-
- Update extconf.conf file to be more flexible to make it easier to build
|
|
87
|
-
on OS X when using MacPorts
|
|
88
|
-
- Updated windows binary to link against proj4.7
|
|
89
|
-
|
|
90
|
-
0.3.0 - August 14, 2008
|
|
91
|
-
=========================
|
|
92
|
-
- Removed Proj4::UV class which was previously deprecated
|
|
93
|
-
- New build infrastructure for Windows (Charlie Savage)
|
|
94
|
-
- Fixed memory leaks in forward() and inverse() methods (Charlie Savage)
|
data/README.rdoc
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
= Proj4rb
|
|
2
|
-
This gem provides Ruby bindings for the Proj Library (https://proj.org). The Proj Library supports converting coordinates between a number of different coordinate systems and projections. Note the Proj library used to be know as Proj4.
|
|
3
|
-
|
|
4
|
-
The bindings support Proj version 4 through the current version (9.3.1). The Proj library and API were completelely written during this time. To support all these versions, the gem dynamically loads code based on the installed Proj version.
|
|
5
|
-
|
|
6
|
-
== Documentation
|
|
7
|
-
Reference documentation is available at https://rubydoc.info/github/cfis/proj4rb.
|
|
8
|
-
|
|
9
|
-
Examples can be found in this README file as well as in the Examples file. In addition, the test suite has exapmles of calling almost every API so when in doubt take a look at them!
|
|
10
|
-
|
|
11
|
-
== Installation
|
|
12
|
-
First install the gem:
|
|
13
|
-
|
|
14
|
-
gem install proj4rb
|
|
15
|
-
|
|
16
|
-
Next install the Proj Library. This of course varies per system, but you want to install the latest version Proj possible. Once installed, you'll need to make sure that libproj is installed on your operating system's load path.
|
|
17
|
-
|
|
18
|
-
== Usage
|
|
19
|
-
To get started first require the gem:
|
|
20
|
-
|
|
21
|
-
require 'proj'
|
|
22
|
-
|
|
23
|
-
If you are using the old Proj4 namespace, then you can do this:
|
|
24
|
-
|
|
25
|
-
require 'proj4'
|
|
26
|
-
|
|
27
|
-
=== CRS
|
|
28
|
-
To create a coordinate system, you can use CRS codes, well-known text (WKT) strings
|
|
29
|
-
or old-style Proj strings (which are deprecated).
|
|
30
|
-
|
|
31
|
-
crs1 = Proj::Crs.new('EPSG:4326')
|
|
32
|
-
|
|
33
|
-
crs2 = Proj::Crs.new('urn:ogc:def:crs:EPSG::4326')
|
|
34
|
-
|
|
35
|
-
crs3 = Proj::Crs.new('+proj=longlat +datum=WGS84 +no_defs +type=crs')
|
|
36
|
-
|
|
37
|
-
crs4 = Proj::Crs.new(<<~EOS)
|
|
38
|
-
GEOGCRS["WGS 84",
|
|
39
|
-
DATUM["World Geodetic System 1984",
|
|
40
|
-
ELLIPSOID["WGS 84",6378137,298.257223563,
|
|
41
|
-
LENGTHUNIT["metre",1]]],
|
|
42
|
-
PRIMEM["Greenwich",0,
|
|
43
|
-
ANGLEUNIT["degree",0.0174532925199433]],
|
|
44
|
-
CS[ellipsoidal,2],
|
|
45
|
-
AXIS["geodetic latitude (Lat)",north,
|
|
46
|
-
ORDER[1],
|
|
47
|
-
ANGLEUNIT["degree",0.0174532925199433]],
|
|
48
|
-
AXIS["geodetic longitude (Lon)",east,
|
|
49
|
-
ORDER[2],
|
|
50
|
-
ANGLEUNIT["degree",0.0174532925199433]],
|
|
51
|
-
USAGE[
|
|
52
|
-
SCOPE["unknown"],
|
|
53
|
-
AREA["World"],
|
|
54
|
-
BBOX[-90,-180,90,180]],
|
|
55
|
-
ID["EPSG",4326]]
|
|
56
|
-
EOS
|
|
57
|
-
|
|
58
|
-
Notice when using the old-style Proj4 string, the addition of the "+type=crs" value.
|
|
59
|
-
|
|
60
|
-
If you are using Proj 5 or newer, then you should create a transformation using epsg strings (see below). If you are using Proj 4, you need to use the deprecated Projection class (see documentation).
|
|
61
|
-
|
|
62
|
-
=== Transformation
|
|
63
|
-
After you have created two coordinate systems, you can then create a transformation. For example, if you want to convert coordinates from the "3-degree Gauss-Kruger zone 3" coordinate system to WGS84 (one version of lat-long) first create a transformation:
|
|
64
|
-
|
|
65
|
-
crs_gk = Proj::Crs.new('EPSG:31467')
|
|
66
|
-
crs_wgs84 = Proj::Crs.new('EPSG:4326')
|
|
67
|
-
transform = Proj::Transformation.new(crs_gk, crs_wgs84)
|
|
68
|
-
|
|
69
|
-
Alternatively, or if you are using Proj 5 or later, you can create a transformation without first
|
|
70
|
-
creating Crs instances. Instead, pass the EPSG information directly to the transformation:
|
|
71
|
-
|
|
72
|
-
transform = Proj::Transformation.new('EPSG:31467', 'EPSG:4326')
|
|
73
|
-
|
|
74
|
-
Once you've created the transformation, you can tranform coordinates using either
|
|
75
|
-
the +forward+ or +inverse+ methods. The forward transformation looks like this:
|
|
76
|
-
|
|
77
|
-
from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
|
|
78
|
-
to = transform.forward(from)
|
|
79
|
-
|
|
80
|
-
assert_in_delta(48.98963932450735, to.x, 0.01)
|
|
81
|
-
assert_in_delta(8.429263044355544, to.y, 0.01)
|
|
82
|
-
assert_in_delta(-5.1790915237, to.z, 0.01)
|
|
83
|
-
assert_in_delta(0, to.t, 0.01)
|
|
84
|
-
|
|
85
|
-
While the inverse transformation looks like this:
|
|
86
|
-
|
|
87
|
-
from = Proj::Coordinate.new(lam: 48.9906726079, phi: 8.4302123334)
|
|
88
|
-
to = transform.inverse(from)
|
|
89
|
-
|
|
90
|
-
assert_in_delta(5428306.389495558, to.x, 0.01)
|
|
91
|
-
assert_in_delta(3458375.3367194114, to.y, 0.01)
|
|
92
|
-
assert_in_delta(0, to.z, 0.01)
|
|
93
|
-
assert_in_delta(0, to.t, 0.01)
|
|
94
|
-
|
|
95
|
-
=== Coordinate Operations
|
|
96
|
-
Transformations are a type of Coordinate Operation. PROJ divides coordinate operations into three groups:
|
|
97
|
-
|
|
98
|
-
* Conversions
|
|
99
|
-
* Projections
|
|
100
|
-
* Transformations
|
|
101
|
-
|
|
102
|
-
Conversions are coordinate operations that do not exert a change in reference frame. The Ruby bindings support these via the Conversion class. See https://proj.org/operations/conversions/index.html for more information.
|
|
103
|
-
|
|
104
|
-
Projections are cartographic mappings of the sphere onto the plane. Technically projections are conversions (according to ISO standards), but PROJ distinguishes them from conversions. The Ruby bindings support these via the Projection module which has methods to create many common projections. A list can be found at https://proj.org/operations/projections/index.html.
|
|
105
|
-
|
|
106
|
-
Transformations are coordinate operations that do cause a change in reference frames. The Ruby bindings support these via the Transformation class.
|
|
107
|
-
|
|
108
|
-
For more information see https://proj.org/operations/index.html
|
|
109
|
-
|
|
110
|
-
=== Operation Factory
|
|
111
|
-
The OperationFactoryContext class can be used to build coordinate operations between two CRSes. This is done by first creating a factory and setting appropiate filters. These include spatial filters, accuracy filters, grid availability filters, etc. Once filters are set, then the factory can be queried for a list of possible conversions. For examples, please see the operation_factory_context_test.rb file.
|
|
112
|
-
|
|
113
|
-
=== Coordinate
|
|
114
|
-
Notice the examples above transform Coordinate objects. A Coordinate consists of up to four double values to represent three directions plus time. In general you will need to fill out at least the first two values:
|
|
115
|
-
|
|
116
|
-
from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
|
|
117
|
-
from = Proj::Coordinate.new(lam: 48.9906726079, phi: 8.4302123334)
|
|
118
|
-
|
|
119
|
-
Lam is longitude and phi is latitude.
|
|
120
|
-
|
|
121
|
-
=== Axis Order
|
|
122
|
-
By default tranformations accept coordinates expressed in the units and axis order of the source CRS and return transformed coordinates in the units and axis order of the target CRS.
|
|
123
|
-
|
|
124
|
-
For most geographic CRSes, the units will be in degrees. For geographic CRSes defined by the EPSG authority, the order of coordinates is latitude and then longitude.
|
|
125
|
-
|
|
126
|
-
For projected CRSes, the units will vary (metre, us-foot, etc.). For projected CRS defined by the EPSG authority, and with EAST / NORTH directions, the order might may be east and then north or north and then east.
|
|
127
|
-
|
|
128
|
-
If you prefer to work with a uniform axis order, regardless of the axis orders mandated by the source and target CRSes, then call the Context#normalize_for_visualization method:
|
|
129
|
-
|
|
130
|
-
normalized = transform.normalize_for_visualization
|
|
131
|
-
|
|
132
|
-
The normalized transformation will return output coordinates in longitude, latitude order for geographic CRSes and easting, northing for most projected CRSes.
|
|
133
|
-
|
|
134
|
-
For more information see https://proj.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent.
|
|
135
|
-
|
|
136
|
-
=== Context
|
|
137
|
-
Contexts are used to support multi-threaded programs. The bindings expose this object via Context.current and store it using thread local storage. Use the context object to access error codes, set proj4 compatability settings, set the logging level and to install custom logging code.
|
|
138
|
-
|
|
139
|
-
Both Crs and Transformation objects take a context object in their constructors. If none is passed, they default to using Context.current
|
|
140
|
-
|
|
141
|
-
== Network Access
|
|
142
|
-
Proj supports downloading grid files on demand if network access is enabled (it is disabled by default). To enable network use the method Context#network_enabled=. To specify the url endpoint use Context#url=. Advanced users can replace Proj's networking code, which uses libcurl, with their own implementation. To do this see the NetworkApi class.
|
|
143
|
-
|
|
144
|
-
Downloaded grids are cached in a sqlite file named cache.db. To specify the location, size and other characteristics of the cache file refer to the GridCache class which is accessible via Context#cache. By default the cache size is 300MB. Caching is on by default but can be disabled via GridCache#enabled=.
|
|
145
|
-
|
|
146
|
-
== Error handling
|
|
147
|
-
When an error occurs, a Proj::Error instance will be thrown with the underlying message provided from the Proj library.
|
|
148
|
-
|
|
149
|
-
== Finding Proj Library (PROJ_LIB_PATH)
|
|
150
|
-
proj4rb will search in a number of well-known locations for the libproj shared library. You can override this by specifying the full path to the library using the PROJ_LIB_PATH environmental variable.
|
|
151
|
-
|
|
152
|
-
== Finding Proj Files (PROJ_DATA)
|
|
153
|
-
Starting with version 6, Proj stores its information (datums, ellipsoids, prime meridians, coordinate systems, units, etc) in a sqlite file called proj.db. If Proj cannot find its database an exception will be raised. In this case, you can set the environmental variable PROJ_DATA to point to the folder that contains the proj.db file. Note PROJ_LIB must be set by whatever launches your Ruby program. The Ruby program itself cannot set this variable and have it work correctly (at least not on windows).
|
|
154
|
-
|
|
155
|
-
For more information see https://proj.org/resource_files.html
|
|
156
|
-
|
|
157
|
-
== Class Hierarchy
|
|
158
|
-
The proj4rb class hierarchy is based on Proj's class hiearchy which, in turn, is derived from http://docs.opengeospatial.org/as/18-005r5/18-005r5.html. It is:
|
|
159
|
-
|
|
160
|
-
PjObject
|
|
161
|
-
CoordinateOperationMixin
|
|
162
|
-
Conversion
|
|
163
|
-
Transformation
|
|
164
|
-
CoordinateSystem
|
|
165
|
-
Crs
|
|
166
|
-
Datum
|
|
167
|
-
Ellipsoid
|
|
168
|
-
PrimeMerdian
|
|
169
|
-
|
|
170
|
-
The PjObject class defines several methods to create new objects:
|
|
171
|
-
|
|
172
|
-
* PjObject.create
|
|
173
|
-
* PjObject.create_from_database
|
|
174
|
-
* PjObject.create_from_name
|
|
175
|
-
* PjObject.create_from_wkt
|
|
176
|
-
|
|
177
|
-
The methods will return instances of the correct subclass.
|
|
178
|
-
|
|
179
|
-
== Tests
|
|
180
|
-
Proj4rb ships with a full test suite designed to work using Proj 6. If you are using an earlier version of Proj, then expect *many* test failures.
|
|
181
|
-
|
|
182
|
-
== License
|
|
183
|
-
Proj4rb is released under the MIT license.
|
|
184
|
-
|
|
185
|
-
== Authors
|
|
186
|
-
The proj4rb Ruby bindings were started by Guilhem Vellut with most of the code
|
|
187
|
-
written by Jochen Topf. Charlie Savage ported the code to Windows and added
|
|
188
|
-
the Windows build infrastructure. Later, he rewrote the code to support
|
|
189
|
-
Proj version 5, 6, 7, 8 and 9 and ported it to use FFI.
|