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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +98 -0
- data/Gemfile +4 -4
- data/README.md +53 -0
- data/lib/api/proj.rb +750 -0
- data/lib/api/proj_experimental.rb +7 -0
- data/lib/api/proj_ffi.rb +47 -0
- data/lib/api/proj_version.rb +26 -0
- data/lib/examples/axis_order_normalization.rb +13 -0
- data/lib/examples/batch_transformation.rb +25 -0
- data/lib/examples/context_logging.rb +26 -0
- data/lib/examples/crs_identification.rb +18 -0
- data/lib/examples/database_query.rb +27 -0
- data/lib/examples/geodetic_distance.rb +38 -0
- data/lib/examples/geodetic_to_projected.rb +18 -0
- data/lib/examples/operation_factory_context.rb +19 -0
- data/lib/examples/pipeline_operator.rb +21 -0
- data/lib/examples/promote_demote_3d.rb +23 -0
- data/lib/examples/serialization_formats.rb +17 -0
- data/lib/examples/transform_bounds.rb +18 -0
- data/lib/examples/transformation_with_area.rb +18 -0
- data/lib/proj/area.rb +74 -74
- data/lib/proj/axis_info.rb +44 -44
- data/lib/proj/bounds.rb +22 -0
- data/lib/proj/bounds3d.rb +45 -0
- data/lib/proj/context.rb +57 -23
- data/lib/proj/conversion.rb +94 -91
- data/lib/proj/coordinate.rb +304 -281
- data/lib/proj/coordinate_metadata.rb +38 -0
- data/lib/proj/coordinate_operation_mixin.rb +464 -381
- data/lib/proj/coordinate_system.rb +143 -137
- data/lib/proj/crs.rb +688 -672
- data/lib/proj/crs_info.rb +47 -47
- data/lib/proj/database.rb +310 -305
- data/lib/proj/datum.rb +32 -32
- data/lib/proj/datum_ensemble.rb +34 -34
- data/lib/proj/domain.rb +82 -0
- data/lib/proj/ellipsoid.rb +77 -77
- data/lib/proj/error.rb +7 -8
- data/lib/proj/file_api_callbacks.rb +165 -0
- data/lib/proj/grid.rb +121 -121
- data/lib/proj/grid_cache.rb +65 -64
- data/lib/proj/grid_info.rb +19 -19
- data/lib/proj/life_span.rb +21 -0
- data/lib/proj/network_api_callbacks.rb +86 -0
- data/lib/proj/operation.rb +66 -42
- data/lib/proj/operation_factory_context.rb +4 -2
- data/lib/proj/options.rb +41 -0
- data/lib/proj/parameter.rb +37 -37
- data/lib/proj/parameters.rb +106 -107
- data/lib/proj/pj_axis_description.rb +26 -0
- data/lib/proj/pj_object.rb +602 -670
- data/lib/proj/pj_objects.rb +45 -45
- data/lib/proj/pj_param_description.rb +28 -0
- data/lib/proj/prime_meridian.rb +65 -65
- data/lib/proj/projection.rb +1771 -698
- data/lib/proj/session.rb +2 -0
- data/lib/proj/transformation.rb +102 -102
- data/lib/proj/unit.rb +81 -108
- data/lib/proj.rb +10 -3
- data/lib/proj4.rb +5 -5
- data/proj4rb.gemspec +10 -5
- data/test/abstract_test.rb +7 -28
- data/test/context_test.rb +210 -172
- data/test/context_validation_test.rb +11 -0
- data/test/conversion_test.rb +376 -368
- data/test/coordinate_metadata_test.rb +34 -0
- data/test/coordinate_system_test.rb +162 -144
- data/test/coordinate_test.rb +289 -34
- data/test/crs_test.rb +1112 -1072
- data/test/database_test.rb +407 -359
- data/test/datum_ensemble_test.rb +64 -64
- data/test/datum_test.rb +61 -54
- data/test/domain_test.rb +72 -0
- data/test/ellipsoid_test.rb +80 -80
- data/test/examples_test.rb +149 -0
- data/test/file_api_example.rb +58 -0
- data/test/file_api_test.rb +74 -66
- data/test/grid_cache_test.rb +72 -72
- data/test/grid_test.rb +126 -141
- data/test/network_api_example.rb +48 -0
- data/test/network_api_test.rb +33 -45
- data/test/operation_factory_context_test.rb +225 -201
- data/test/operation_test.rb +40 -29
- data/test/options_test.rb +17 -0
- data/test/parameters_test.rb +86 -40
- data/test/pj_object_test.rb +221 -179
- data/test/prime_meridian_test.rb +75 -75
- data/test/proj_test.rb +58 -58
- data/test/projection_test.rb +680 -650
- data/test/session_test.rb +78 -77
- data/test/transformation_test.rb +238 -210
- data/test/unit_test.rb +114 -76
- metadata +45 -31
- data/ChangeLog +0 -89
- data/README.rdoc +0 -207
- data/lib/api/api.rb +0 -117
- data/lib/api/api_5_0.rb +0 -338
- data/lib/api/api_5_1.rb +0 -7
- data/lib/api/api_5_2.rb +0 -5
- data/lib/api/api_6_0.rb +0 -146
- data/lib/api/api_6_1.rb +0 -5
- data/lib/api/api_6_2.rb +0 -10
- data/lib/api/api_6_3.rb +0 -6
- data/lib/api/api_7_0.rb +0 -69
- data/lib/api/api_7_1.rb +0 -73
- data/lib/api/api_7_2.rb +0 -14
- data/lib/api/api_8_0.rb +0 -6
- data/lib/api/api_8_1.rb +0 -24
- data/lib/api/api_8_2.rb +0 -6
- data/lib/api/api_9_1.rb +0 -7
- data/lib/api/api_9_2.rb +0 -9
- data/lib/api/api_experimental.rb +0 -201
- data/lib/proj/file_api.rb +0 -166
- data/lib/proj/network_api.rb +0 -92
data/lib/proj/session.rb
CHANGED
data/lib/proj/transformation.rb
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
module Proj
|
|
2
|
-
# Transformations are {CoordinateOperationMixin coordinate operations} that
|
|
3
|
-
# convert {Coordinate coordinates} from one {Crs} to another.
|
|
4
|
-
# In Proj they are defined as operations that exert a change in reference frame
|
|
5
|
-
# while {Conversion conversions } do not.
|
|
6
|
-
class Transformation < PjObject
|
|
7
|
-
include CoordinateOperationMixin
|
|
8
|
-
|
|
9
|
-
# Create a Transformation
|
|
10
|
-
#
|
|
11
|
-
# @param context [Context] Context
|
|
12
|
-
# @param name [String] Name of the transformation. Default is nil.
|
|
13
|
-
# @param auth_name [String] Transformation authority name. Default is nil.
|
|
14
|
-
# @param code [String] Transformation code. Default is nil.
|
|
15
|
-
# @param source_crs [CoordinateSystem] Source CRS
|
|
16
|
-
# @param target_crs [CoordinateSystem] Target CRS
|
|
17
|
-
# @param interpolation_crs [CoordinateSystem] Interpolation. Default is nil
|
|
18
|
-
# @param method_name [String] Method name. Default is nil.
|
|
19
|
-
# @param method_auth_name [String] Method authority name. Default is nil.
|
|
20
|
-
# @param method_code [String] Method code. Default is nil.
|
|
21
|
-
# @param params [Array<Parameter>] Parameter descriptions
|
|
22
|
-
# @param accuracy [Float] Accuracy of the transformation in meters. A negative value means unknown.
|
|
23
|
-
#
|
|
24
|
-
# @return [Transformation]
|
|
25
|
-
def self.create(context, name: nil, auth_name: nil, code: nil,
|
|
26
|
-
source_crs:, target_crs:, interpolation_crs: nil,
|
|
27
|
-
method_name: nil, method_auth_name: nil, method_code: nil,
|
|
28
|
-
params:, accuracy:)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
# easting first, northing second,
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
# @see
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
# @param
|
|
63
|
-
# @param
|
|
64
|
-
# @param
|
|
65
|
-
# @param
|
|
66
|
-
# @param
|
|
67
|
-
# @param
|
|
68
|
-
# @param
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
ptr = if source.is_a?(Crs) && target.is_a?(Crs)
|
|
84
|
-
if Api.method_defined?(:proj_create_crs_to_crs_from_pj)
|
|
85
|
-
Api.proj_create_crs_to_crs_from_pj(context, source, target, area,
|
|
86
|
-
else
|
|
87
|
-
Api.proj_create_crs_to_crs(context, source.definition, target.definition, area)
|
|
88
|
-
end
|
|
89
|
-
else
|
|
90
|
-
Api.proj_create_crs_to_crs(context, source, target, nil)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
if ptr.null?
|
|
94
|
-
Error.check_context(context)
|
|
95
|
-
# If that does not raise an error then no operation was found
|
|
96
|
-
raise(Error, "No operation found matching criteria")
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
super(ptr, context)
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
1
|
+
module Proj
|
|
2
|
+
# Transformations are {CoordinateOperationMixin coordinate operations} that
|
|
3
|
+
# convert {Coordinate coordinates} from one {Crs} to another.
|
|
4
|
+
# In Proj they are defined as operations that exert a change in reference frame
|
|
5
|
+
# while {Conversion conversions } do not.
|
|
6
|
+
class Transformation < PjObject
|
|
7
|
+
include CoordinateOperationMixin
|
|
8
|
+
|
|
9
|
+
# Create a Transformation
|
|
10
|
+
#
|
|
11
|
+
# @param context [Context] Context
|
|
12
|
+
# @param name [String] Name of the transformation. Default is nil.
|
|
13
|
+
# @param auth_name [String] Transformation authority name. Default is nil.
|
|
14
|
+
# @param code [String] Transformation code. Default is nil.
|
|
15
|
+
# @param source_crs [CoordinateSystem] Source CRS
|
|
16
|
+
# @param target_crs [CoordinateSystem] Target CRS
|
|
17
|
+
# @param interpolation_crs [CoordinateSystem] Interpolation. Default is nil
|
|
18
|
+
# @param method_name [String] Method name. Default is nil.
|
|
19
|
+
# @param method_auth_name [String] Method authority name. Default is nil.
|
|
20
|
+
# @param method_code [String] Method code. Default is nil.
|
|
21
|
+
# @param params [Array<Parameter>] Parameter descriptions
|
|
22
|
+
# @param accuracy [Float] Accuracy of the transformation in meters. A negative value means unknown.
|
|
23
|
+
#
|
|
24
|
+
# @return [Transformation]
|
|
25
|
+
def self.create(context, name: nil, auth_name: nil, code: nil,
|
|
26
|
+
source_crs:, target_crs:, interpolation_crs: nil,
|
|
27
|
+
method_name: nil, method_auth_name: nil, method_code: nil,
|
|
28
|
+
params:, accuracy:)
|
|
29
|
+
Error.validate_context!(context)
|
|
30
|
+
|
|
31
|
+
params_ptr = FFI::MemoryPointer.new(Api::PjParamDescription, params.size)
|
|
32
|
+
params.each_with_index do |param, i|
|
|
33
|
+
param_description_target = Api::PjParamDescription.new(params_ptr[i])
|
|
34
|
+
param_description_source = param.to_description
|
|
35
|
+
param_description_target.to_ptr.__copy_from__(param_description_source.to_ptr, Api::PjParamDescription.size)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
ptr = Api.proj_create_transformation(context, name, auth_name, code,
|
|
39
|
+
source_crs, target_crs, interpolation_crs,
|
|
40
|
+
method_name, method_auth_name, method_code,
|
|
41
|
+
params.count, params_ptr, accuracy)
|
|
42
|
+
self.create_object(ptr, context)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Transforms a {Coordinate} from the source {Crs} to the target {Crs}. Coordinates should be expressed in
|
|
46
|
+
# the units and axis order of the definition of the source CRS. The returned transformed coordinate will
|
|
47
|
+
# be in the units and axis order of the definition of the target CRS.
|
|
48
|
+
#
|
|
49
|
+
# For most geographic Crses, the units will be in degrees. For geographic CRS defined by the EPSG authority,
|
|
50
|
+
# the order of coordinates is latitude first, longitude second. When using a PROJ initialization string,
|
|
51
|
+
# on contrary, the order will be longitude first, latitude second.
|
|
52
|
+
#
|
|
53
|
+
# For projected CRS, the units may vary (metre, us-foot, etc..).
|
|
54
|
+
#
|
|
55
|
+
# For projected CRS defined by the EPSG authority, and with EAST / NORTH directions, the axis order might be
|
|
56
|
+
# easting first, northing second, or the reverse. When using a PROJ string, the order will be
|
|
57
|
+
# easting first, northing second, except if the +axis parameter modifies it.
|
|
58
|
+
#
|
|
59
|
+
# @see https://proj.org/development/reference/functions.html#c.proj_create_crs_to_crs_from_pj
|
|
60
|
+
# @see https://proj.org/development/reference/functions.html#c.proj_create_crs_to_crs proj_create_crs_to_crs
|
|
61
|
+
#
|
|
62
|
+
# @param source [Crs, String] The source Crs. See the Crs documentation for the string format
|
|
63
|
+
# @param target [Crs, String] The target Crs. See the Crs documentation for the string format
|
|
64
|
+
# @param area [Area] If an area is specified a more accurate transformation between two given systems can be chosen
|
|
65
|
+
# @param context [Context]
|
|
66
|
+
# @param authority [String] Restricts the authority of coordinate operations looked up in the database
|
|
67
|
+
# @param accuracy [Float] Sets the minimum desired accuracy (in metres) of the candidate coordinate operations
|
|
68
|
+
# @param allow_ballpark [Boolean] Set to false to disallow the use of Ballpark transformation in the candidate coordinate operations.
|
|
69
|
+
# @param only_best [Boolean] Set to true to cause PROJ to error out if the best transformation cannot be used. Requires Proj 9.2 and higher
|
|
70
|
+
#
|
|
71
|
+
# @return [Transformation] A new transformation
|
|
72
|
+
def initialize(source, target, context=nil,
|
|
73
|
+
area: nil, authority: nil, accuracy: nil, allow_ballpark: nil, only_best: nil, force_over: nil)
|
|
74
|
+
|
|
75
|
+
context ||= Context.current
|
|
76
|
+
|
|
77
|
+
options = Options.new("AUTHORITY": authority,
|
|
78
|
+
"ACCURACY": accuracy.nil? ? nil : accuracy.to_s,
|
|
79
|
+
"ALLOW_BALLPARK": allow_ballpark.nil? ? nil : (allow_ballpark ? "YES" : "NO"),
|
|
80
|
+
"ONLY_BEST": only_best.nil? ? nil : (only_best ? "YES" : "NO"),
|
|
81
|
+
"FORCE_OVER": force_over.nil? ? nil : (force_over ? "YES" : "NO"))
|
|
82
|
+
|
|
83
|
+
ptr = if source.is_a?(Crs) && target.is_a?(Crs)
|
|
84
|
+
if Api.method_defined?(:proj_create_crs_to_crs_from_pj)
|
|
85
|
+
Api.proj_create_crs_to_crs_from_pj(context, source, target, area, options)
|
|
86
|
+
else
|
|
87
|
+
Api.proj_create_crs_to_crs(context, source.definition, target.definition, area)
|
|
88
|
+
end
|
|
89
|
+
else
|
|
90
|
+
Api.proj_create_crs_to_crs(context, source, target, nil)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if ptr.null?
|
|
94
|
+
Error.check_context(context)
|
|
95
|
+
# If that does not raise an error then no operation was found
|
|
96
|
+
raise(Error, "No operation found matching criteria")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
super(ptr, context)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
data/lib/proj/unit.rb
CHANGED
|
@@ -1,109 +1,82 @@
|
|
|
1
|
-
module Proj
|
|
2
|
-
class Unit
|
|
3
|
-
# @!attribute [r] auth_name
|
|
4
|
-
# @return [String] Authority name
|
|
5
|
-
# @!attribute [r] code
|
|
6
|
-
# @return [String] Object code
|
|
7
|
-
# @!attribute [r] name
|
|
8
|
-
# @return [String] Object name. For example "metre", "US survey foot", etc
|
|
9
|
-
# @!attribute [r] category
|
|
10
|
-
# @return [String] Category of the unit: one of "linear", "linear_per_time", "angular", "angular_per_time", "scale", "scale_per_time" or "time"
|
|
11
|
-
# @!attribute [r] conv_factor
|
|
12
|
-
# @return [String] Conversion factor to apply to transform from that unit to the corresponding SI unit (metre for "linear", radian for "angular", etc.). It might be 0 in some cases to indicate no known conversion factor
|
|
13
|
-
# @!attribute [r] proj_short_name
|
|
14
|
-
# @return [String] PROJ short name, like "m", "ft", "us-ft", etc... Might be nil
|
|
15
|
-
# @!attribute [r] deprecated
|
|
16
|
-
# @return [Boolean] Whether the object is deprecated
|
|
17
|
-
attr_reader :auth_name, :code, :name, :category, :conv_factor, :proj_short_name, :deprecated
|
|
18
|
-
|
|
19
|
-
# Returns a list of built in Units.
|
|
20
|
-
def self.built_in(auth_name: nil, category: nil, allow_deprecated: false)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
self.
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def unit_type
|
|
83
|
-
case self.category
|
|
84
|
-
when "linear"
|
|
85
|
-
:PJ_UT_LINEAR
|
|
86
|
-
when "linear_per_time"
|
|
87
|
-
:PJ_UT_LINEAR
|
|
88
|
-
when "angular"
|
|
89
|
-
:PJ_UT_ANGULAR
|
|
90
|
-
when "angular_per_time"
|
|
91
|
-
:PJ_UT_ANGULAR
|
|
92
|
-
when "scale"
|
|
93
|
-
:PJ_UT_SCALE
|
|
94
|
-
when "scale_per_time"
|
|
95
|
-
:PJ_UT_SCALE
|
|
96
|
-
when "time"
|
|
97
|
-
:PJ_UT_TIME
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def to_s
|
|
102
|
-
self.name
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def inspect
|
|
106
|
-
"#<#{self.class} authority=\"#{auth_name}\", code=\"#{code}\", name=\"#{name}\">"
|
|
107
|
-
end
|
|
108
|
-
end
|
|
1
|
+
module Proj
|
|
2
|
+
class Unit
|
|
3
|
+
# @!attribute [r] auth_name
|
|
4
|
+
# @return [String] Authority name
|
|
5
|
+
# @!attribute [r] code
|
|
6
|
+
# @return [String] Object code
|
|
7
|
+
# @!attribute [r] name
|
|
8
|
+
# @return [String] Object name. For example "metre", "US survey foot", etc
|
|
9
|
+
# @!attribute [r] category
|
|
10
|
+
# @return [String] Category of the unit: one of "linear", "linear_per_time", "angular", "angular_per_time", "scale", "scale_per_time" or "time"
|
|
11
|
+
# @!attribute [r] conv_factor
|
|
12
|
+
# @return [String] Conversion factor to apply to transform from that unit to the corresponding SI unit (metre for "linear", radian for "angular", etc.). It might be 0 in some cases to indicate no known conversion factor
|
|
13
|
+
# @!attribute [r] proj_short_name
|
|
14
|
+
# @return [String] PROJ short name, like "m", "ft", "us-ft", etc... Might be nil
|
|
15
|
+
# @!attribute [r] deprecated
|
|
16
|
+
# @return [Boolean] Whether the object is deprecated
|
|
17
|
+
attr_reader :auth_name, :code, :name, :category, :conv_factor, :proj_short_name, :deprecated
|
|
18
|
+
|
|
19
|
+
# Returns a list of built in Units.
|
|
20
|
+
def self.built_in(auth_name: nil, category: nil, allow_deprecated: false)
|
|
21
|
+
database = Database.new(Context.current)
|
|
22
|
+
database.units(auth_name: auth_name, category: category, allow_deprecated: allow_deprecated)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Create a new Unit
|
|
26
|
+
#
|
|
27
|
+
# @param auth_name [String] Authority name
|
|
28
|
+
# @param code [String] Object code
|
|
29
|
+
# @param name [String] Object name. For example "metre", "US survey foot", etc
|
|
30
|
+
# @param category [String] Category of the unit: one of "linear", "linear_per_time", "angular", "angular_per_time", "scale", "scale_per_time" or "time"
|
|
31
|
+
# @param conv_factor [String] Conversion factor to apply to transform from that unit to the corresponding SI unit (metre for "linear", radian for "angular", etc.). It might be 0 in some cases to indicate no known conversion factor
|
|
32
|
+
# @param proj_short_name [String] PROJ short name, like "m", "ft", "us-ft", etc... Might be nil
|
|
33
|
+
# @param deprecated [Boolean] Whether the object is deprecated
|
|
34
|
+
#
|
|
35
|
+
# @return [Unit]
|
|
36
|
+
def initialize(auth_name, code, name, category, conv_factor, proj_short_name, deprecated)
|
|
37
|
+
@auth_name = auth_name
|
|
38
|
+
@code = code
|
|
39
|
+
@name = name
|
|
40
|
+
@category = category
|
|
41
|
+
@conv_factor = conv_factor
|
|
42
|
+
@proj_short_name = proj_short_name
|
|
43
|
+
@deprecated = deprecated
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def <=>(other)
|
|
47
|
+
self.name <=> other.name
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def ==(other)
|
|
51
|
+
self.auth_name == other.auth_name &&
|
|
52
|
+
self.code == other.code
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def unit_type
|
|
56
|
+
case self.category
|
|
57
|
+
when "linear"
|
|
58
|
+
:PJ_UT_LINEAR
|
|
59
|
+
when "linear_per_time"
|
|
60
|
+
:PJ_UT_LINEAR
|
|
61
|
+
when "angular"
|
|
62
|
+
:PJ_UT_ANGULAR
|
|
63
|
+
when "angular_per_time"
|
|
64
|
+
:PJ_UT_ANGULAR
|
|
65
|
+
when "scale"
|
|
66
|
+
:PJ_UT_SCALE
|
|
67
|
+
when "scale_per_time"
|
|
68
|
+
:PJ_UT_SCALE
|
|
69
|
+
when "time"
|
|
70
|
+
:PJ_UT_TIME
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def to_s
|
|
75
|
+
self.name
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def inspect
|
|
79
|
+
"#<#{self.class} authority=\"#{auth_name}\", code=\"#{code}\", name=\"#{name}\">"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
109
82
|
end
|
data/lib/proj.rb
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
2
|
|
|
3
|
-
require_relative 'api/
|
|
3
|
+
require_relative 'api/proj_ffi'
|
|
4
4
|
|
|
5
|
+
require_relative 'proj/pj_axis_description'
|
|
6
|
+
require_relative 'proj/pj_param_description'
|
|
7
|
+
require_relative 'proj/options'
|
|
5
8
|
require_relative 'proj/pj_object'
|
|
6
9
|
require_relative 'proj/pj_objects'
|
|
7
10
|
require_relative 'proj/coordinate_operation_mixin'
|
|
@@ -13,20 +16,24 @@ require_relative 'proj/transformation'
|
|
|
13
16
|
require_relative 'proj/area'
|
|
14
17
|
require_relative 'proj/axis_info'
|
|
15
18
|
require_relative 'proj/bounds'
|
|
19
|
+
require_relative 'proj/bounds3d'
|
|
20
|
+
require_relative 'proj/coordinate_metadata'
|
|
16
21
|
require_relative 'proj/coordinate_system'
|
|
17
22
|
require_relative 'proj/crs_info'
|
|
23
|
+
require_relative 'proj/life_span'
|
|
18
24
|
require_relative 'proj/context'
|
|
19
25
|
require_relative 'proj/coordinate'
|
|
20
26
|
require_relative 'proj/database'
|
|
21
27
|
require_relative 'proj/datum'
|
|
28
|
+
require_relative 'proj/domain'
|
|
22
29
|
require_relative 'proj/datum_ensemble'
|
|
23
30
|
require_relative 'proj/ellipsoid'
|
|
24
31
|
require_relative 'proj/error'
|
|
25
|
-
require_relative 'proj/
|
|
32
|
+
require_relative 'proj/file_api_callbacks'
|
|
26
33
|
require_relative 'proj/grid'
|
|
27
34
|
require_relative 'proj/grid_cache'
|
|
28
35
|
require_relative 'proj/grid_info'
|
|
29
|
-
require_relative 'proj/
|
|
36
|
+
require_relative 'proj/network_api_callbacks'
|
|
30
37
|
require_relative 'proj/parameter'
|
|
31
38
|
require_relative 'proj/operation'
|
|
32
39
|
require_relative 'proj/operation_factory_context'
|
data/lib/proj4.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
|
|
3
|
-
# This file is for backwards compatibility to the Proj4 namespace
|
|
4
|
-
require_relative './proj'
|
|
5
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# This file is for backwards compatibility to the Proj4 namespace
|
|
4
|
+
require_relative './proj'
|
|
5
|
+
|
|
6
6
|
Proj4 = Proj
|
data/proj4rb.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |spec|
|
|
2
2
|
spec.name = 'proj4rb'
|
|
3
|
-
spec.version = '
|
|
3
|
+
spec.version = '5.0.0'
|
|
4
4
|
spec.summary = 'Ruby bindings for the Proj coordinate transformation library'
|
|
5
5
|
spec.description = <<-EOF
|
|
6
6
|
Ruby bindings for the Proj coordinate transformation library
|
|
@@ -13,18 +13,23 @@ Gem::Specification.new do |spec|
|
|
|
13
13
|
|
|
14
14
|
spec.requirements << 'Proj Library'
|
|
15
15
|
spec.require_path = 'lib'
|
|
16
|
-
spec.files = Dir['
|
|
16
|
+
spec.files = Dir['CHANGELOG.md',
|
|
17
17
|
'Gemfile',
|
|
18
18
|
'MIT-LICENSE',
|
|
19
19
|
'proj4rb.gemspec',
|
|
20
20
|
'Rakefile',
|
|
21
|
-
'README.
|
|
21
|
+
'README.md',
|
|
22
22
|
'lib/**/*.rb',
|
|
23
23
|
'test/*.rb']
|
|
24
24
|
|
|
25
|
-
spec.
|
|
25
|
+
spec.metadata = {
|
|
26
|
+
'homepage_uri' => spec.homepage,
|
|
27
|
+
'source_code_uri' => 'https://github.com/cfis/proj4rb',
|
|
28
|
+
'changelog_uri' => 'https://github.com/cfis/proj4rb/blob/master/CHANGELOG.md',
|
|
29
|
+
'documentation_uri' => 'https://cfis.github.io/proj4rb/'
|
|
30
|
+
}
|
|
26
31
|
|
|
27
|
-
spec.add_dependency "ffi"
|
|
32
|
+
spec.add_dependency "ffi", ">=1.17.4"
|
|
28
33
|
|
|
29
34
|
spec.add_development_dependency('bundler')
|
|
30
35
|
spec.add_development_dependency('rake')
|
data/test/abstract_test.rb
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
require 'bundler/setup'
|
|
2
|
-
require 'minitest/autorun'
|
|
3
|
-
require 'proj'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.proj8?
|
|
11
|
-
Proj::Api::PROJ_VERSION >= Gem::Version.new("8.0.0")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.proj9?
|
|
15
|
-
Proj::Api::PROJ_VERSION >= Gem::Version.new("9.0.0")
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def proj7?
|
|
19
|
-
self.class.proj7?
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def proj8?
|
|
23
|
-
self.class.proj8?
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def proj9?
|
|
27
|
-
self.class.proj9?
|
|
28
|
-
end
|
|
1
|
+
require 'bundler/setup'
|
|
2
|
+
require 'minitest/autorun'
|
|
3
|
+
require 'proj'
|
|
4
|
+
|
|
5
|
+
Minitest.load_plugins
|
|
6
|
+
|
|
7
|
+
class AbstractTest < Minitest::Test
|
|
29
8
|
end
|