proj4rb 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +6 -0
- data/README.rdoc +5 -5
- data/lib/api/api.rb +21 -0
- data/lib/api/api_5_0.rb +7 -1
- data/lib/api/api_6_0.rb +4 -2
- data/lib/api/api_7_0.rb +1 -0
- data/lib/api/api_experimental.rb +5 -0
- data/lib/proj/area.rb +1 -0
- data/lib/proj/axis_info.rb +1 -1
- data/lib/proj/context.rb +4 -3
- data/lib/proj/conversion.rb +1 -2
- data/lib/proj/coordinate_operation_mixin.rb +9 -9
- data/lib/proj/coordinate_system.rb +17 -17
- data/lib/proj/crs.rb +75 -75
- data/lib/proj/crs_info.rb +15 -15
- data/lib/proj/database.rb +3 -3
- data/lib/proj/datum.rb +1 -1
- data/lib/proj/ellipsoid.rb +3 -3
- data/lib/proj/grid.rb +1 -1
- data/lib/proj/operation.rb +2 -2
- data/lib/proj/operation_factory_context.rb +2 -1
- data/lib/proj/parameters.rb +1 -0
- data/lib/proj/pj_object.rb +6 -6
- data/lib/proj/pj_objects.rb +1 -0
- data/lib/proj/prime_meridian.rb +2 -2
- data/lib/proj/session.rb +2 -1
- data/lib/proj/transformation.rb +4 -4
- data/lib/proj/unit.rb +1 -1
- data/lib/proj.rb +11 -7
- data/proj4rb.gemspec +1 -1
- data/test/conversion_test.rb +2 -2
- data/test/coordinate_system_test.rb +7 -7
- data/test/crs_test.rb +12 -12
- data/test/database_test.rb +1 -1
- data/test/transformation_test.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dee29581eba9124621bcf04204e9d224e39bba0482caa174fc57014c49a37be7
|
4
|
+
data.tar.gz: 46529fe96f62f6a94cc26baf8f1a695e38ff9099b16c52c58b503380d8773594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 145525e768e261cc293be7ec9851c6e19590f40572de114262da5b4c94eb9baec8296131071eee3438de0df7a18e7ace0981f14c2b6b0079b37739d852879833
|
7
|
+
data.tar.gz: f79972d062f3ce4f3f03e8ba2d67b908a928407b5cec336cfc79c83dca745e310c06d339d78d506bf419eeec3a8bd6c3e543aba950c37f5537edfba625f9da84
|
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@ between a number of different coordinate systems and projections.
|
|
5
5
|
== Documentation
|
6
6
|
Reference documentation is available at https://rubydoc.info/github/cfis/proj4rb.
|
7
7
|
|
8
|
-
Examples can be found in this README file as well as in the
|
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
9
|
|
10
10
|
== Installation
|
11
11
|
First install the gem in the usual manner:
|
@@ -138,7 +138,7 @@ If you prefer to work with a uniform axis order, regardless of the axis orders m
|
|
138
138
|
|
139
139
|
The normalized transformation will return output coordinates in longitude, latitude order for geographic CRSes and easting, northing for most projected CRSes.
|
140
140
|
|
141
|
-
For more information see
|
141
|
+
For more information see https://proj.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent.
|
142
142
|
|
143
143
|
=== Context
|
144
144
|
Contexts are used to support multi-threaded programs. The bindings expose this object via Context.current
|
@@ -149,9 +149,9 @@ Both Crs and Transformation objects take a context object in their constructors.
|
|
149
149
|
to using Context.current
|
150
150
|
|
151
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
|
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
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
|
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
155
|
|
156
156
|
== Error handling
|
157
157
|
When an error occurs, a Proj::Error instance will be thrown with the underlying message provided
|
@@ -172,7 +172,7 @@ The Ruby program itself cannot set this variable and have it work correctly (at
|
|
172
172
|
For more information see https://proj.org/resource_files.html
|
173
173
|
|
174
174
|
== Class Hierarchy
|
175
|
-
The proj4rb class hierarchy is based on Proj's class hiearchy which, in turn, is derived from
|
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
176
|
|
177
177
|
PjObject
|
178
178
|
CoordinateOperationMixin
|
data/lib/api/api.rb
CHANGED
@@ -5,6 +5,9 @@ module Proj
|
|
5
5
|
module Api
|
6
6
|
extend FFI::Library
|
7
7
|
|
8
|
+
# List of knows PROJ library versions
|
9
|
+
#
|
10
|
+
# @return [Array<String>]
|
8
11
|
def self.library_versions
|
9
12
|
["25", # 9.2
|
10
13
|
"9_1", # 9.1
|
@@ -18,6 +21,9 @@ module Proj
|
|
18
21
|
"11"] # 4.9
|
19
22
|
end
|
20
23
|
|
24
|
+
# Search paths to use when looking for PROJ library
|
25
|
+
#
|
26
|
+
# @return [Array<String>]
|
21
27
|
def self.search_paths
|
22
28
|
result = case RbConfig::CONFIG['host_os']
|
23
29
|
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
@@ -33,18 +39,27 @@ module Proj
|
|
33
39
|
result
|
34
40
|
end
|
35
41
|
|
42
|
+
# Windows search paths for PROJ library
|
43
|
+
#
|
44
|
+
# @return [Array<String>]
|
36
45
|
def self.windows_search_paths
|
37
46
|
self.library_versions.map do |version|
|
38
47
|
["libproj-#{version}", "libproj_#{version}"]
|
39
48
|
end.flatten
|
40
49
|
end
|
41
50
|
|
51
|
+
# Linux search paths for PROJ library
|
52
|
+
#
|
53
|
+
# @return [Array<String>]
|
42
54
|
def self.linux_search_paths
|
43
55
|
self.library_versions.map do |version|
|
44
56
|
"libproj.so.#{version}"
|
45
57
|
end
|
46
58
|
end
|
47
59
|
|
60
|
+
# MacOS search paths for PROJ library
|
61
|
+
#
|
62
|
+
# @return [Array<String>]
|
48
63
|
def self.macos_search_paths
|
49
64
|
# On MacOS only support HomeBrew since the MacPort is unsupported and ancient (5.2).
|
50
65
|
self.library_versions.map do |version|
|
@@ -52,6 +67,9 @@ module Proj
|
|
52
67
|
end
|
53
68
|
end
|
54
69
|
|
70
|
+
# Load PROJ library
|
71
|
+
#
|
72
|
+
# @return [FFI::DynamicLibrary]
|
55
73
|
def self.load_library
|
56
74
|
if ENV["PROJ_LIB_PATH"]
|
57
75
|
ffi_lib ENV["PROJ_LIB_PATH"]
|
@@ -62,6 +80,9 @@ module Proj
|
|
62
80
|
ffi_libraries.first
|
63
81
|
end
|
64
82
|
|
83
|
+
# Load API files based on PROJ version
|
84
|
+
#
|
85
|
+
# @return [nil]
|
65
86
|
def self.load_api
|
66
87
|
# First load the base 5.0 api so we can determine the Proj Version
|
67
88
|
require_relative './api_5_0'
|
data/lib/api/api_5_0.rb
CHANGED
@@ -28,7 +28,6 @@ module Proj
|
|
28
28
|
:PJ, :pointer, # projection entry point
|
29
29
|
:descr, :pointer # description text
|
30
30
|
end
|
31
|
-
PJ_OPERATIONS = PJ_LIST
|
32
31
|
|
33
32
|
class PJ_ELLPS < FFI::Struct
|
34
33
|
layout :id, :string, # ellipse keyword name
|
@@ -197,6 +196,7 @@ module Proj
|
|
197
196
|
:lastupdate, [:string, 16] # Date of last update in YYYY-MM-DD format
|
198
197
|
end
|
199
198
|
|
199
|
+
# @return [Symbol]
|
200
200
|
PJ_LOG_LEVEL = enum(:PJ_LOG_NONE , 0,
|
201
201
|
:PJ_LOG_ERROR, 1,
|
202
202
|
:PJ_LOG_DEBUG, 2,
|
@@ -206,11 +206,13 @@ module Proj
|
|
206
206
|
:PJ_LOG_DEBUG_MINOR, 3) # for proj_api.h compatibility
|
207
207
|
|
208
208
|
# Apply transformation to observation - in forward or inverse direction
|
209
|
+
# @return [Symbol]
|
209
210
|
PJ_DIRECTION = enum(:PJ_FWD, 1, # Forward
|
210
211
|
:PJ_IDENT, 0, # Do nothing
|
211
212
|
:PJ_INV, -1) # Inverse
|
212
213
|
|
213
214
|
# Object category
|
215
|
+
# @return [Symbol]
|
214
216
|
PJ_CATEGORY = enum(:PJ_CATEGORY_ELLIPSOID,
|
215
217
|
:PJ_CATEGORY_PRIME_MERIDIAN,
|
216
218
|
:PJ_CATEGORY_DATUM,
|
@@ -218,6 +220,7 @@ module Proj
|
|
218
220
|
:PJ_CATEGORY_COORDINATE_OPERATION,
|
219
221
|
:PJ_CATEGORY_DATUM_ENSEMBLE)
|
220
222
|
|
223
|
+
# @return [Symbol]
|
221
224
|
PJ_TYPE = enum(:PJ_TYPE_UNKNOWN,
|
222
225
|
:PJ_TYPE_ELLIPSOID,
|
223
226
|
:PJ_TYPE_PRIME_MERIDIAN,
|
@@ -256,9 +259,11 @@ module Proj
|
|
256
259
|
|
257
260
|
:PJ_TYPE_COORDINATE_METADATA)
|
258
261
|
|
262
|
+
# @return [Symbol]
|
259
263
|
PJ_PROJ_STRING_TYPE = enum(:PJ_PROJ_5,
|
260
264
|
:PJ_PROJ_4)
|
261
265
|
|
266
|
+
# @return [Symbol]
|
262
267
|
PJ_COORDINATE_SYSTEM_TYPE = enum(:PJ_CS_TYPE_UNKNOWN,
|
263
268
|
:PJ_CS_TYPE_CARTESIAN,
|
264
269
|
:PJ_CS_TYPE_ELLIPSOIDAL,
|
@@ -270,6 +275,7 @@ module Proj
|
|
270
275
|
:PJ_CS_TYPE_TEMPORALCOUNT,
|
271
276
|
:PJ_CS_TYPE_TEMPORALMEASURE)
|
272
277
|
|
278
|
+
# @return [Symbol]
|
273
279
|
PJ_WKT_TYPE = enum(:PJ_WKT2_2015,
|
274
280
|
:PJ_WKT2_2015_SIMPLIFIED,
|
275
281
|
:PJ_WKT2_2019,
|
data/lib/api/api_6_0.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
module Proj
|
2
2
|
module Api
|
3
3
|
# Comparison criteria
|
4
|
+
# @return [Symbol]
|
4
5
|
PJ_COMPARISON_CRITERION = enum(:PJ_COMP_STRICT, # All properties are identical
|
5
6
|
:PJ_COMP_EQUIVALENT, # The objects are equivalent for the purpose of coordinate operations. They can differ by the name of their objects, identifiers, other metadata. Parameters may be expressed in different units, provided that the value is (with some tolerance) the same once expressed in a common unit.
|
6
7
|
:PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS) # Same as EQUIVALENT, relaxed with an exception that the axis order of the base CRS of a DerivedCRS/ProjectedCRS or the axis order of a GeographicCRS is ignored. Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS
|
7
8
|
|
8
9
|
#Guessed WKT "dialect"
|
10
|
+
# @return [Symbol]
|
9
11
|
PJ_GUESSED_WKT_DIALECT = enum(:PJ_GUESSED_WKT2_2019,
|
10
12
|
:PJ_GUESSED_WKT2_2018,
|
11
13
|
:PJ_GUESSED_WKT2_2015,
|
@@ -65,9 +67,9 @@ module Proj
|
|
65
67
|
:type, PJ_TYPE, # Object type
|
66
68
|
:deprecated, :int, # Whether the object is deprecated
|
67
69
|
:bbox_valid, :int, # Whether bbox values in degrees are valid
|
68
|
-
:west_lon_degree, :double,
|
70
|
+
:west_lon_degree, :double, # Western-most longitude of the area of use, in degrees.
|
69
71
|
:south_lat_degree, :double, # Southern-most latitude of the area of use, in degrees.
|
70
|
-
:east_lon_degree, :double,
|
72
|
+
:east_lon_degree, :double, # Eastern-most longitude of the area of use, in degrees.
|
71
73
|
:north_lat_degree, :double, # Northern-most latitude of the area of use, in degrees.
|
72
74
|
:area_name, :string, # Name of the area of use
|
73
75
|
:projection_method_name, :string] # Name of the projection method for a projected CRS. Might be NULL even for projected CRS in some cases.
|
data/lib/api/api_7_0.rb
CHANGED
@@ -4,6 +4,7 @@ module Proj
|
|
4
4
|
typedef :pointer, :PROJ_FILE_HANDLE
|
5
5
|
typedef :pointer, :USER_DATA
|
6
6
|
|
7
|
+
# @return [Symbol]
|
7
8
|
PROJ_OPEN_ACCESS = enum(:PROJ_OPEN_ACCESS_READ_ONLY, # Read-only access. Equivalent to "rb"
|
8
9
|
:PROJ_OPEN_ACCESS_READ_UPDATE, # Read-update access. File should be created if not existing. Equivalent to "r+b
|
9
10
|
:PROJ_OPEN_ACCESS_CREATE) # Create access. File should be truncated to 0-byte if already existing. Equivalent to "w+b"
|
data/lib/api/api_experimental.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
1
|
module Proj
|
2
2
|
module Api
|
3
3
|
if Api::PROJ_VERSION >= Gem::Version.new('6.0.0')
|
4
|
+
|
5
|
+
# @return [Symbol]
|
4
6
|
PJ_UNIT_TYPE = enum(:PJ_UT_ANGULAR,
|
5
7
|
:PJ_UT_LINEAR,
|
6
8
|
:PJ_UT_SCALE,
|
7
9
|
:PJ_UT_TIME)
|
8
10
|
|
11
|
+
# @return [Symbol]
|
9
12
|
PJ_CARTESIAN_CS_2D_TYPE = enum(:PJ_CART2D_EASTING_NORTHING,
|
10
13
|
:PJ_CART2D_NORTHING_EASTING,
|
11
14
|
:PJ_CART2D_NORTH_POLE_EASTING_SOUTH_NORTHING_SOUTH,
|
12
15
|
:PJ_CART2D_SOUTH_POLE_EASTING_NORTH_NORTHING_NORTH,
|
13
16
|
:PJ_CART2D_WESTING_SOUTHING)
|
14
17
|
|
18
|
+
# @return [Symbol]
|
15
19
|
PJ_ELLIPSOIDAL_CS_2D_TYPE = enum(:PJ_ELLPS2D_LONGITUDE_LATITUDE,
|
16
20
|
:PJ_ELLPS2D_LATITUDE_LONGITUDE)
|
17
21
|
|
@@ -156,6 +160,7 @@ module Proj
|
|
156
160
|
end
|
157
161
|
|
158
162
|
if Api::PROJ_VERSION >= Gem::Version.new('6.3.0')
|
163
|
+
# @return [Symbol]
|
159
164
|
PJ_ELLIPSOIDAL_CS_3D_TYPE = enum(:PJ_ELLPS3D_LONGITUDE_LATITUDE_HEIGHT,
|
160
165
|
:PJ_ELLPS3D_LATITUDE_LONGITUDE_HEIGHT)
|
161
166
|
|
data/lib/proj/area.rb
CHANGED
data/lib/proj/axis_info.rb
CHANGED
data/lib/proj/context.rb
CHANGED
@@ -23,6 +23,7 @@ module Proj
|
|
23
23
|
Thread.current[:proj_context] ||= Context.new
|
24
24
|
end
|
25
25
|
|
26
|
+
# @!visibility private
|
26
27
|
def self.finalize(pointer)
|
27
28
|
proc do
|
28
29
|
Api.proj_context_destroy(pointer)
|
@@ -177,7 +178,7 @@ module Proj
|
|
177
178
|
#
|
178
179
|
# @see https://proj.org/development/reference/functions.html#c.proj_context_get_user_writable_directory
|
179
180
|
#
|
180
|
-
# @param [Boolean] If
|
181
|
+
# @param create [Boolean] If true create the directory if it does not exist already. Defaults to false.
|
181
182
|
#
|
182
183
|
# @return [String] Directory
|
183
184
|
def user_directory(create = false)
|
@@ -206,7 +207,7 @@ module Proj
|
|
206
207
|
end
|
207
208
|
end
|
208
209
|
|
209
|
-
# Installs a new {FileApi
|
210
|
+
# Installs a new {FileApiImpl FileApi}
|
210
211
|
#
|
211
212
|
# @see https://proj.org/development/reference/functions.html#c.proj_context_set_fileapi
|
212
213
|
def set_file_api(file_api_klass)
|
@@ -219,7 +220,7 @@ module Proj
|
|
219
220
|
@file_api = file_api_klass.new(self)
|
220
221
|
end
|
221
222
|
|
222
|
-
# Installs a new {NetworkApi
|
223
|
+
# Installs a new {NetworkApiImpl NetworkApi}
|
223
224
|
#
|
224
225
|
# @see https://proj.org/development/reference/functions.html#c.proj_context_set_network_callbacks
|
225
226
|
def set_network_api(network_api_klass)
|
data/lib/proj/conversion.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'stringio'
|
3
3
|
|
4
4
|
module Proj
|
5
|
-
# Conversions are {
|
5
|
+
# Conversions are {CoordinateOperationMixin coordinate operations} that convert a source
|
6
6
|
# {Coordinate coordinate} to a new value. In Proj they are defined as operations that
|
7
7
|
# do not exert a change in reference frame while {Transformation transformations } do.
|
8
8
|
class Conversion < PjObject
|
@@ -20,7 +20,6 @@ module Proj
|
|
20
20
|
# @param method_auth_name [String] Method authority name. Default is nil.
|
21
21
|
# @param method_code [String] Method code. Default is nil.
|
22
22
|
# @param params [Array<Parameter>] Parameter descriptions
|
23
|
-
# @param accuracy [Double] Accuracy of the transformation in meters. A negative value means unknown.
|
24
23
|
#
|
25
24
|
# @return [Conversion]
|
26
25
|
def self.create_conversion(context, name:, auth_name:, code:, method_name:, method_auth_name:, method_code:, params:)
|
@@ -6,7 +6,7 @@ module Proj
|
|
6
6
|
:unit_conv_factor, :unit_name, :unit_auth_name, :unit_code, :unit_category,
|
7
7
|
keyword_init: true)
|
8
8
|
|
9
|
-
# Coordinate Operations convert {Coordinate
|
9
|
+
# Coordinate Operations convert {Coordinate coordinates} to a new value. In Proj they are
|
10
10
|
# can either by {Conversion conversions} that do not exert a change in reference frame
|
11
11
|
# or {Transformation transformations} which do.
|
12
12
|
module CoordinateOperationMixin
|
@@ -168,8 +168,8 @@ module Proj
|
|
168
168
|
self.transform(coord, :PJ_INV)
|
169
169
|
end
|
170
170
|
|
171
|
-
# Transforms a {Coordinate} in the specified direction. See {
|
172
|
-
# {
|
171
|
+
# Transforms a {Coordinate} in the specified direction. See {CoordinateOperationMixin#forward forward} and
|
172
|
+
# {CoordinateOperationMixin#inverse inverse}
|
173
173
|
#
|
174
174
|
# @see https://proj.org/development/reference/functions.html#c.proj_trans
|
175
175
|
#
|
@@ -212,7 +212,7 @@ module Proj
|
|
212
212
|
# Transforms an array of {Coordinate coordinates}. Individual points that fail to transform
|
213
213
|
# will have their components set to Infinity.
|
214
214
|
#
|
215
|
-
# @param
|
215
|
+
# @param coordinates [Array<Coordinate>] Coordinates to transform
|
216
216
|
# @param direction [PJ_DIRECTION] The direction of the transformation
|
217
217
|
#
|
218
218
|
# @return [Array<Coordinate>] Array of transformed coordinates
|
@@ -245,7 +245,7 @@ module Proj
|
|
245
245
|
# @param iterations [Integer] The number of roundtrip transformations
|
246
246
|
# @param coordinate [Coordinate] The input coordinate
|
247
247
|
#
|
248
|
-
# @return [
|
248
|
+
# @return [Float] The euclidean distance of the starting point coordinate and the last coordinate after n iterations back and forth.
|
249
249
|
def roundtrip(direction, iterations, coordinate)
|
250
250
|
Api.proj_roundtrip(self, direction, iterations, coordinate.pj_coord)
|
251
251
|
end
|
@@ -254,7 +254,7 @@ module Proj
|
|
254
254
|
#
|
255
255
|
# @see https://proj.org/development/reference/functions.html#c.proj_normalize_for_visualization
|
256
256
|
#
|
257
|
-
# @return [
|
257
|
+
# @return [CoordinateOperationMixin] A new CoordinateOperation or nil in case of error
|
258
258
|
def normalize_for_visualization
|
259
259
|
ptr = Api.proj_normalize_for_visualization(self.context, self)
|
260
260
|
self.class.create_object(ptr, self.context)
|
@@ -264,7 +264,7 @@ module Proj
|
|
264
264
|
#
|
265
265
|
# @see }https://proj.org/development/reference/functions.html#c.proj_trans_get_last_used_operation proj_trans_get_last_used_operation
|
266
266
|
#
|
267
|
-
# @return [
|
267
|
+
# @return [CoordinateOperationMixin] The last used operation
|
268
268
|
def last_used_operation
|
269
269
|
ptr = Api.proj_trans_get_last_used_operation(self)
|
270
270
|
self.class.create_object(ptr, self.context)
|
@@ -284,7 +284,7 @@ module Proj
|
|
284
284
|
#
|
285
285
|
# @see https://proj.org/development/reference/functions.html#c.proj_coordoperation_get_accuracy
|
286
286
|
#
|
287
|
-
# @return [
|
287
|
+
# @return [Float] The accuracy, or a negative value if unknown or in case of error.
|
288
288
|
def accuracy
|
289
289
|
Api.proj_coordoperation_get_accuracy(self.context, self)
|
290
290
|
end
|
@@ -348,7 +348,7 @@ module Proj
|
|
348
348
|
#
|
349
349
|
# @param error_if_incompatible [Boolean] If true an exception is thrown if the coordinate operation is not compatible with a WKT1 TOWGS84 representation
|
350
350
|
#
|
351
|
-
# @return [Array<
|
351
|
+
# @return [Array<Float>]] Array of 7 numbers that represent translation, rotation and scale parameters.
|
352
352
|
# Rotation and scale difference terms might be zero if the transformation only includes translation parameters
|
353
353
|
def to_wgs84(error_if_incompatible = false)
|
354
354
|
parameter_count = 7
|
@@ -6,11 +6,11 @@ module Proj
|
|
6
6
|
# Create a CoordinateSystem
|
7
7
|
#
|
8
8
|
# @param context [Context] The context associated with the CoordinateSystem
|
9
|
-
# @param
|
9
|
+
# @param cs_type [PJ_COORDINATE_SYSTEM_TYPE] Coordinate system type
|
10
10
|
# @param axes [Array<PJ_AXIS_DESCRIPTION>] Array of Axes
|
11
11
|
#
|
12
12
|
# @return [CoordinateSystem]
|
13
|
-
def self.create(
|
13
|
+
def self.create(cs_type, axes, context)
|
14
14
|
axes_ptr = FFI::MemoryPointer.new(Api::PJ_AXIS_DESCRIPTION, axes.size)
|
15
15
|
axes.each_with_index do |axis, i|
|
16
16
|
axis_description_target = Api::PJ_AXIS_DESCRIPTION.new(axes_ptr[i])
|
@@ -18,7 +18,7 @@ module Proj
|
|
18
18
|
axis_description_target.to_ptr.__copy_from__(axis_description_source.to_ptr, Api::PJ_AXIS_DESCRIPTION.size)
|
19
19
|
end
|
20
20
|
|
21
|
-
pointer = Api.proj_create_cs(context,
|
21
|
+
pointer = Api.proj_create_cs(context, cs_type, axes.count, axes_ptr)
|
22
22
|
Error.check_context(context)
|
23
23
|
self.create_object(pointer, context)
|
24
24
|
end
|
@@ -26,13 +26,13 @@ module Proj
|
|
26
26
|
# Create an Ellipsoidal 2D CoordinateSystem
|
27
27
|
#
|
28
28
|
# @param context [Context] The context associated with the CoordinateSystem
|
29
|
-
# @param
|
29
|
+
# @param cs_type [PJ_COORDINATE_SYSTEM_TYPE] Coordinate system type
|
30
30
|
# @param unit_name [String] Name of the angular units. Or nil for degree
|
31
|
-
# @param unit_conv_factor [
|
31
|
+
# @param unit_conv_factor [Float] Conversion factor from the angular unit to radian. Set to 0 if unit name is degree
|
32
32
|
#
|
33
33
|
# @return [CoordinateSystem]
|
34
|
-
def self.create_ellipsoidal_2d(
|
35
|
-
pointer = Api.proj_create_ellipsoidal_2D_cs(context,
|
34
|
+
def self.create_ellipsoidal_2d(cs_type, context, unit_name: nil, unit_conv_factor: 0)
|
35
|
+
pointer = Api.proj_create_ellipsoidal_2D_cs(context, cs_type, unit_name, unit_conv_factor)
|
36
36
|
Error.check_context(context)
|
37
37
|
self.create_object(pointer, context)
|
38
38
|
end
|
@@ -40,15 +40,15 @@ module Proj
|
|
40
40
|
# Create an Ellipsoidal 3D CoordinateSystem
|
41
41
|
#
|
42
42
|
# @param context [Context] The context associated with the CoordinateSystem
|
43
|
-
# @param
|
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
|
-
# @param horizontal_angular_unit_conv_factor [
|
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
46
|
# @param vertical_linear_unit_name [String] Name of the angular units. Or nil for meter
|
47
|
-
# @param vertical_linear_unit_conv_factor [
|
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
|
48
48
|
#
|
49
49
|
# @return [CoordinateSystem]
|
50
|
-
def self.create_ellipsoidal_3d(
|
51
|
-
pointer = Api.proj_create_ellipsoidal_3D_cs(context,
|
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)
|
51
|
+
pointer = Api.proj_create_ellipsoidal_3D_cs(context, cs_type, horizontal_angular_unit_name, horizontal_angular_unit_conv_factor, vertical_linear_unit_name, vertical_linear_unit_conv_factor)
|
52
52
|
Error.check_context(context)
|
53
53
|
self.create_object(pointer, context)
|
54
54
|
end
|
@@ -56,13 +56,13 @@ module Proj
|
|
56
56
|
# Create a CartesiansCS 2D coordinate system
|
57
57
|
#
|
58
58
|
# @param context [Context] The context associated with the CoordinateSystem
|
59
|
-
# @param
|
59
|
+
# @param cs_type [PJ_COORDINATE_SYSTEM_TYPE] Coordinate system type
|
60
60
|
# @param unit_name [String] Name of the unit. Default is nil.
|
61
|
-
# @param unit_conv_factor [
|
61
|
+
# @param unit_conv_factor [Float] Unit conversion factor to SI. Default is 0.
|
62
62
|
#
|
63
63
|
# @return [CoordinateSystem]
|
64
|
-
def self.create_cartesian_2d(context,
|
65
|
-
pointer = Api.proj_create_cartesian_2D_cs(context,
|
64
|
+
def self.create_cartesian_2d(context, cs_type, unit_name: nil, unit_conv_factor: 0)
|
65
|
+
pointer = Api.proj_create_cartesian_2D_cs(context, cs_type, unit_name, unit_conv_factor)
|
66
66
|
Error.check_context(context)
|
67
67
|
self.create_object(pointer, context)
|
68
68
|
end
|
@@ -72,7 +72,7 @@ module Proj
|
|
72
72
|
# @see https://proj.org/development/reference/functions.html#c.proj_cs_get_type
|
73
73
|
#
|
74
74
|
# @return [PJ_COORDINATE_SYSTEM_TYPE]
|
75
|
-
def
|
75
|
+
def cs_type
|
76
76
|
result = Api.proj_cs_get_type(self.context, self)
|
77
77
|
if result == :PJ_CS_TYPE_UNKNOWN
|
78
78
|
Error.check_object(self)
|