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