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.
Files changed (116) 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 -38
  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 -680
  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 -672
  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 +54 -25
  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 -5
  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 -1082
  71. data/test/database_test.rb +407 -391
  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 -205
  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 -187
  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 +44 -32
  95. data/ChangeLog +0 -94
  96. data/README.rdoc +0 -189
  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_9_4.rb +0 -6
  114. data/lib/api/api_experimental.rb +0 -201
  115. data/lib/proj/file_api.rb +0 -166
  116. 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.1
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: 2024-01-31 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,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
- - 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_9_4.rb
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/file_api.rb
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/network_api.rb
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
- 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/
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: 3.5.5
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.