proj4rb 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dee29581eba9124621bcf04204e9d224e39bba0482caa174fc57014c49a37be7
4
- data.tar.gz: 46529fe96f62f6a94cc26baf8f1a695e38ff9099b16c52c58b503380d8773594
3
+ metadata.gz: 26b50da982077e9d6cd97efc8746bd4e888bccf689d7bb3a8e0a752493165181
4
+ data.tar.gz: 3001ce9757d511e27bc4c7c0118bf2da986ab8e811c106c1517d5a5cf3cdd6a9
5
5
  SHA512:
6
- metadata.gz: 145525e768e261cc293be7ec9851c6e19590f40572de114262da5b4c94eb9baec8296131071eee3438de0df7a18e7ace0981f14c2b6b0079b37739d852879833
7
- data.tar.gz: f79972d062f3ce4f3f03e8ba2d67b908a928407b5cec336cfc79c83dca745e310c06d339d78d506bf419eeec3a8bd6c3e543aba950c37f5537edfba625f9da84
6
+ metadata.gz: 6da17b22219016b19b4e93b78a3bbb01a4794b1a21d57b2ef76cff54eb7d4c5ef50ef73679c9f91497774a10690c359f1d7bdd297892ab5745c0149bf1a3eeec
7
+ data.tar.gz: 991f95662e5d10663da570b9e6efed6b37ba2c2b86d94389d485050e385c50ed6a13ad44aa84ac42b29d6a74830350739fa47a2ae5f736b09325fc5db439f5dc
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
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
+
1
6
  4.1.0 - March 12, 2023
2
7
  ======================
3
8
  * Fix YARD warnings
data/README.rdoc CHANGED
@@ -1,6 +1,7 @@
1
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.
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.
4
5
 
5
6
  == Documentation
6
7
  Reference documentation is available at https://rubydoc.info/github/cfis/proj4rb.
@@ -8,13 +9,11 @@ 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!
9
10
 
10
11
  == Installation
11
- First install the gem in the usual manner:
12
+ First install the gem:
12
13
 
13
14
  gem install proj4rb
14
15
 
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.
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.
18
17
 
19
18
  == Usage
20
19
  To get started first require the gem:
@@ -58,19 +57,16 @@ To create a coordinate system, you can use CRS codes, well-known text (WKT) stri
58
57
 
59
58
  Notice when using the old-style Proj4 string, the addition of the "+type=crs" value.
60
59
 
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).
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).
63
61
 
64
62
  === 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:
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:
68
64
 
69
65
  crs_gk = Proj::Crs.new('EPSG:31467')
70
66
  crs_wgs84 = Proj::Crs.new('EPSG:4326')
71
67
  transform = Proj::Transformation.new(crs_gk, crs_wgs84)
72
68
 
73
- Alternatively, or if you are using Proj 5, you can create a transformation without first
69
+ Alternatively, or if you are using Proj 5 or later, you can create a transformation without first
74
70
  creating Crs instances. Instead, pass the EPSG information directly to the transformation:
75
71
 
76
72
  transform = Proj::Transformation.new('EPSG:31467', 'EPSG:4326')
@@ -105,8 +101,7 @@ Transformations are a type of Coordinate Operation. PROJ divides coordinate oper
105
101
 
106
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.
107
103
 
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.
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.
110
105
 
111
106
  Transformations are coordinate operations that do cause a change in reference frames. The Ruby bindings support these via the Transformation class.
112
107
 
@@ -116,9 +111,7 @@ For more information see https://proj.org/operations/index.html
116
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.
117
112
 
118
113
  === 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:
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:
122
115
 
123
116
  from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
124
117
  from = Proj::Coordinate.new(lam: 48.9906726079, phi: 8.4302123334)
@@ -141,12 +134,9 @@ The normalized transformation will return output coordinates in longitude, latit
141
134
  For more information see https://proj.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent.
142
135
 
143
136
  === 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.
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.
147
138
 
148
- Both Crs and Transformation objects take a context object in their constructors. If none is passed, they default
149
- to using Context.current
139
+ Both Crs and Transformation objects take a context object in their constructors. If none is passed, they default to using Context.current
150
140
 
151
141
  == Network Access
152
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.
@@ -154,20 +144,13 @@ Proj supports downloading grid files on demand if network access is enabled (it
154
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=.
155
145
 
156
146
  == Error handling
157
- When an error occurs, a Proj::Error instance will be thrown with the underlying message provided
158
- from the Proj library.
147
+ When an error occurs, a Proj::Error instance will be thrown with the underlying message provided from the Proj library.
159
148
 
160
149
  == 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.
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.
164
151
 
165
152
  == 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).
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).
171
154
 
172
155
  For more information see https://proj.org/resource_files.html
173
156
 
@@ -194,8 +177,7 @@ The PjObject class defines several methods to create new objects:
194
177
  The methods will return instances of the correct subclass.
195
178
 
196
179
  == 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.
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.
199
181
 
200
182
  == License
201
183
  Proj4rb is released under the MIT license.
@@ -204,4 +186,4 @@ Proj4rb is released under the MIT license.
204
186
  The proj4rb Ruby bindings were started by Guilhem Vellut with most of the code
205
187
  written by Jochen Topf. Charlie Savage ported the code to Windows and added
206
188
  the Windows build infrastructure. Later, he rewrote the code to support
207
- Proj version 5 and 6 and ported it to use FFI.
189
+ Proj version 5, 6, 7, 8 and 9 and ported it to use FFI.
data/lib/api/api.rb CHANGED
@@ -93,7 +93,7 @@ module Proj
93
93
  '6.0.0', '6.1.0', '6.2.0', '6.3.0',
94
94
  '7.0.0', '7.1.0', '7.2.0',
95
95
  '8.0.0', '8.1.0', '8.2.0',
96
- '9.1.0', '9.2.0']
96
+ '9.1.0', '9.2.0', '9.4.0']
97
97
 
98
98
  versions.each do |version|
99
99
  api_version = Gem::Version.new(version)
@@ -0,0 +1,6 @@
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_coordinate_metadata_create, [:PJ_CONTEXT, :PJ, :double], :PJ
4
+ attach_function :proj_crs_has_point_motion_operation, [:PJ_CONTEXT, :PJ], :int
5
+ end
6
+ end
@@ -0,0 +1,38 @@
1
+ # encoding: UTF-8
2
+
3
+ module Proj
4
+ # Coordinate metadata is the information required to make coordinates unambiguous. For a
5
+ # coordinate set referenced to a static CRS it is the CRS definition. For a
6
+ # coordinate set referenced to a dynamic CRS it is the CRS definition together
7
+ # with the coordinate epoch of the coordinates in the coordinate set.
8
+ #
9
+ # In a dynamic CRS, coordinates of a point on the surface of the Earth may change with time.
10
+ # To be unambiguous the coordinates must always be qualified with the epoch at which they
11
+ # are valid. The coordinate epoch is not necessarily the epoch at which the observation
12
+ # was collected.
13
+ class CoordinateMetadata < PjObject
14
+ # Create a CoordinateMetadata object
15
+ #
16
+ # @param crs [Crs] The associated Crs
17
+ # @param context [Context]. An optional Context
18
+ # @param epoch [Double]. Epoch at wich the CRS is valid
19
+ #
20
+ # @return [CoordinateMetadata]
21
+ def initialize(crs, context=nil, epoch=nil)
22
+ ptr = Api.proj_coordinate_metadata_create(context || Context.current, crs, epoch)
23
+
24
+ if ptr.null?
25
+ Error.check_object(self)
26
+ end
27
+
28
+ super(ptr, context)
29
+ end
30
+
31
+ # Returns the coordinate epoch
32
+ #
33
+ # @return [Double]
34
+ def epoch
35
+ Api.proj_coordinate_metadata_get_epoch(self.context, self)
36
+ end
37
+ end
38
+ end
@@ -43,8 +43,8 @@ module Proj
43
43
  # @param cs_type [PJ_COORDINATE_SYSTEM_TYPE] Coordinate system type
44
44
  # @param horizontal_angular_unit_name [String] Name of the angular units. Or nil for degree
45
45
  # @param horizontal_angular_unit_conv_factor [Float] Conversion factor from the angular unit to radian. Set to 0 if horizontal_angular_unit_name name is degree
46
- # @param vertical_linear_unit_name [String] Name of the angular units. Or nil for meter
47
- # @param vertical_linear_unit_conv_factor [Float] Conversion factor from the linear unit to meter. Set to 0 if vertical_linear_unit_name name is meter
46
+ # @param vertical_linear_unit_name [String] Name of the linear units. Or nil for meters.
47
+ # # @param vertical_linear_unit_conv_factor [Float] Conversion factor from the linear unit to meter. Set to 0 if vertical_linear_unit_name is meter.
48
48
  #
49
49
  # @return [CoordinateSystem]
50
50
  def self.create_ellipsoidal_3d(cs_type, context, horizontal_angular_unit_name: nil, horizontal_angular_unit_conv_factor: 0, vertical_linear_unit_name: nil, vertical_linear_unit_conv_factor: 0)
data/lib/proj/crs.rb CHANGED
@@ -461,6 +461,14 @@ module Proj
461
461
  self.class.create_object(ptr, self.context)
462
462
  end
463
463
 
464
+ # Returns whether a CRS has an associated PointMotionOperation
465
+ #
466
+ # @return [Boolean]
467
+ def point_motion_operation?
468
+ result = Api.proj_crs_get_coordoperation(self.context, self)
469
+ result == 1 ? true : false
470
+ end
471
+
464
472
  # Returns the prime meridian
465
473
  #
466
474
  # @see https://proj.org/development/reference/functions.html#c.proj_get_prime_meridian
@@ -31,6 +31,8 @@ module Proj
31
31
  Ellipsoid
32
32
  when :PJ_TYPE_PRIME_MERIDIAN
33
33
  PrimeMeridian
34
+ when :PJ_TYPE_COORDINATE_METADATA
35
+ CoordinateMetadata
34
36
  else
35
37
  # Return whatever the current class is
36
38
  self