proj4rb 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/proj/session.rb CHANGED
@@ -2,6 +2,7 @@ module Proj
2
2
  class Session
3
3
  attr_reader :context
4
4
 
5
+ # @!visibility private
5
6
  def self.finalize(context, pointer)
6
7
  proc do
7
8
  Api.proj_insert_object_session_destroy(context, pointer)
@@ -24,7 +25,7 @@ module Proj
24
25
  # @param authority [String] - Authority name into which the object will be inserted. Must not be nil
25
26
  # @param code [Integer] - Code with which the object will be inserted.Must not be nil
26
27
  # @param numeric_codes [Boolean] - Whether intermediate objects that can be created should use numeric codes (true), or may be alphanumeric (false)
27
- # @param allowed_authorities [Array[String]] - Authorities to which intermediate objects are allowed to refer to. "authority" will be implicitly added to it.
28
+ # @param allowed_authorities [Array<String>] - Authorities to which intermediate objects are allowed to refer to. "authority" will be implicitly added to it.
28
29
  #
29
30
  # @return [Strings] - List of insert statements
30
31
  def get_insert_statements(object, authority, code, numeric_codes = false, allowed_authorities = nil)
@@ -1,5 +1,5 @@
1
1
  module Proj
2
- # Transformations are {CoordinateOperationMix coordinate operations} that
2
+ # Transformations are {CoordinateOperationMixin coordinate operations} that
3
3
  # convert {Coordinate coordinates} from one {Crs} to another.
4
4
  # In Proj they are defined as operations that exert a change in reference frame
5
5
  # while {Conversion conversions } do not.
@@ -19,7 +19,7 @@ module Proj
19
19
  # @param method_auth_name [String] Method authority name. Default is nil.
20
20
  # @param method_code [String] Method code. Default is nil.
21
21
  # @param params [Array<Parameter>] Parameter descriptions
22
- # @param accuracy [Double] Accuracy of the transformation in meters. A negative value means unknown.
22
+ # @param accuracy [Float] Accuracy of the transformation in meters. A negative value means unknown.
23
23
  #
24
24
  # @return [Transformation]
25
25
  def self.create(context, name: nil, auth_name: nil, code: nil,
@@ -58,8 +58,8 @@ module Proj
58
58
  # @see https://proj.org/development/reference/functions.html#c.proj_create_crs_to_crs_from_pj
59
59
  # @see https://proj.org/development/reference/functions.html#c.proj_create_crs_to_crs proj_create_crs_to_crs
60
60
  #
61
- # @param source [Crs | String] The source Crs. See the Crs documentation for the string format
62
- # @param target [Crs | String] The target Crs. See the Crs documentation for the string format
61
+ # @param source [Crs, String] The source Crs. See the Crs documentation for the string format
62
+ # @param target [Crs, String] The target Crs. See the Crs documentation for the string format
63
63
  # @param area [Area] If an area is specified a more accurate transformation between two given systems can be chosen
64
64
  # @param context [Context]
65
65
  # @param authority [String] Restricts the authority of coordinate operations looked up in the database
data/lib/proj/unit.rb CHANGED
@@ -79,7 +79,7 @@ module Proj
79
79
  self.code == other.code
80
80
  end
81
81
 
82
- def type
82
+ def unit_type
83
83
  case self.category
84
84
  when "linear"
85
85
  :PJ_UT_LINEAR
data/lib/proj.rb CHANGED
@@ -40,6 +40,8 @@ module Proj
40
40
  # Returns information about the Proj library
41
41
  #
42
42
  # @see https://proj.org/development/reference/functions.html#c.proj_info proj_info
43
+ #
44
+ # @return [PJ_INFO]
43
45
  def self.info
44
46
  Api.proj_info
45
47
  end
@@ -47,6 +49,8 @@ module Proj
47
49
  # Returns the Proj version
48
50
  #
49
51
  # @see https://proj.org/development/reference/functions.html#c.proj_info proj_info
52
+ #
53
+ # @return [String]
50
54
  def self.version
51
55
  self.info[:version]
52
56
  end
@@ -55,7 +59,7 @@ module Proj
55
59
  #
56
60
  # @see https://proj.org/development/reference/functions.html#c.proj_info proj_info
57
61
  #
58
- # @return Array<string> List of search paths
62
+ # @return [Array<String>] List of search paths
59
63
  def self.search_paths
60
64
  self.info[:searchpath].split(";")
61
65
  end
@@ -75,9 +79,9 @@ module Proj
75
79
  #
76
80
  # see https://proj.org/development/reference/functions.html#c.proj_torad proj_torad
77
81
  #
78
- # @param value [Double] Value in degrees to convert
82
+ # @param value [Float] Value in degrees to convert
79
83
  #
80
- # @return [Double]
84
+ # @return [Float]
81
85
  def self.degrees_to_radians(value)
82
86
  Api.proj_torad(value)
83
87
  end
@@ -86,9 +90,9 @@ module Proj
86
90
  #
87
91
  # see https://proj.org/development/reference/functions.html#c.proj_todeg proj_todeg
88
92
  #
89
- # @param value [Double] Value in radians to convert
93
+ # @param value [Float] Value in radians to convert
90
94
  #
91
- # @return [Double]
95
+ # @return [Float]
92
96
  def self.radians_to_degrees(value)
93
97
  Api.proj_todeg(value)
94
98
  end
@@ -99,7 +103,7 @@ module Proj
99
103
  #
100
104
  # @param value [String] Value to be converted to radians
101
105
  #
102
- # @return [Double]
106
+ # @return [Float]
103
107
  def self.degrees_minutes_seconds_to_radians(value)
104
108
  ptr = FFI::MemoryPointer.new(:string)
105
109
  Api.proj_dmstor(value, ptr)
@@ -110,7 +114,7 @@ module Proj
110
114
  # @see https://proj.org/development/reference/functions.html#c.proj_rtodms proj_rtodms
111
115
  # @see https://proj.org/development/reference/functions.html#c.proj_rtodms2 proj_rtodms2
112
116
  #
113
- # @param value [Double] Value to be converted in radians
117
+ # @param value [Float] Value to be converted in radians
114
118
  # @param positive [String] Character denoting positive direction, typically 'N' or 'E'. Default 'N'
115
119
  # @param negative [String] Character denoting negative direction, typically 'S' or 'W'. Default 'S'
116
120
  #
data/proj4rb.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'proj4rb'
3
- spec.version = '4.0.0'
3
+ spec.version = '4.1.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
@@ -326,9 +326,9 @@ class ConversionTest < AbstractTest
326
326
  context = Proj::Context.new
327
327
  coordinate_system = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LONGITUDE_LATITUDE, context)
328
328
 
329
- crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellps_name: "WGS 84",
329
+ crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellipsoid_name: "WGS 84",
330
330
  semi_major_meter: 6378137, inv_flattening: 298.257223563,
331
- prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_units_conv: 0.0174532925199433,
331
+ prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_angular_units_conv: 0.0174532925199433,
332
332
  coordinate_system: coordinate_system)
333
333
 
334
334
  mercator = Proj::Projection.mercator_variant_a(context, center_lat: 0, center_long: 1,
@@ -8,9 +8,9 @@ class CoordinateSystemTest < AbstractTest
8
8
  crs = Proj::Crs.new('EPSG:4326', context)
9
9
  cs = crs.coordinate_system
10
10
  axes = cs.axes
11
- cs = Proj::CoordinateSystem.create(cs.type, axes, context)
11
+ cs = Proj::CoordinateSystem.create(cs.cs_type, axes, context)
12
12
  assert_equal(2, cs.axis_count)
13
- assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
13
+ assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.cs_type)
14
14
  assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
15
15
  refute(cs.auth_name)
16
16
  refute(cs.id_code)
@@ -20,7 +20,7 @@ class CoordinateSystemTest < AbstractTest
20
20
  context = Proj::Context.new
21
21
  cs = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LONGITUDE_LATITUDE, context)
22
22
  assert_equal(2, cs.axis_count)
23
- assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
23
+ assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.cs_type)
24
24
  assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
25
25
  refute(cs.auth_name)
26
26
  refute(cs.id_code)
@@ -30,7 +30,7 @@ class CoordinateSystemTest < AbstractTest
30
30
  context = Proj::Context.new
31
31
  cs = Proj::CoordinateSystem.create_ellipsoidal_3d(:PJ_ELLPS3D_LATITUDE_LONGITUDE_HEIGHT, context)
32
32
  assert_equal(3, cs.axis_count)
33
- assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
33
+ assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.cs_type)
34
34
  assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
35
35
 
36
36
  axis = cs.axis_info(0)
@@ -54,7 +54,7 @@ class CoordinateSystemTest < AbstractTest
54
54
  horizontal_angular_unit_name: "foo", horizontal_angular_unit_conv_factor: 0.5,
55
55
  vertical_linear_unit_name: "bar", vertical_linear_unit_conv_factor: 0.6)
56
56
  assert_equal(3, cs.axis_count)
57
- assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
57
+ assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.cs_type)
58
58
  assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
59
59
 
60
60
  axis = cs.axis_info(0)
@@ -83,7 +83,7 @@ class CoordinateSystemTest < AbstractTest
83
83
  context = Proj::Context.new
84
84
  coordinate_system = Proj::CoordinateSystem.create_cartesian_2d(context, :PJ_CART2D_EASTING_NORTHING)
85
85
  assert_equal(2, coordinate_system.axis_count)
86
- assert_equal(:PJ_CS_TYPE_CARTESIAN, coordinate_system.type)
86
+ assert_equal(:PJ_CS_TYPE_CARTESIAN, coordinate_system.cs_type)
87
87
  assert_equal(:PJ_TYPE_UNKNOWN, coordinate_system.proj_type)
88
88
  end
89
89
 
@@ -91,7 +91,7 @@ class CoordinateSystemTest < AbstractTest
91
91
  crs = Proj::Crs.new('EPSG:4326')
92
92
  cs = crs.coordinate_system
93
93
  refute(cs.name)
94
- assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.type)
94
+ assert_equal(:PJ_CS_TYPE_ELLIPSOIDAL, cs.cs_type)
95
95
  assert_equal(:PJ_TYPE_UNKNOWN, cs.proj_type)
96
96
  assert_equal("EPSG", cs.auth_name)
97
97
  assert_equal("6422", cs.id_code)
data/test/crs_test.rb CHANGED
@@ -702,9 +702,9 @@ class CrsTest < AbstractTest
702
702
  context = Proj::Context.new
703
703
  coordinate_system = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LATITUDE_LONGITUDE, context)
704
704
 
705
- crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellps_name: "WGS 84",
705
+ crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellipsoid_name: "WGS 84",
706
706
  semi_major_meter: 6378137, inv_flattening: 298.257223563,
707
- prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_units_conv: 0.0174532925199433,
707
+ prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_angular_units_conv: 0.0174532925199433,
708
708
  coordinate_system: coordinate_system)
709
709
 
710
710
  crs_2 = Proj::Crs.create_from_database("EPSG", "4326", :PJ_CATEGORY_CRS)
@@ -720,7 +720,7 @@ class CrsTest < AbstractTest
720
720
 
721
721
  def test_geocentric
722
722
  context = Proj::Context.new
723
- crs = Proj::Crs.create_geocentric(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellps_name: "WGS 84",
723
+ crs = Proj::Crs.create_geocentric(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellipsoid_name: "WGS 84",
724
724
  semi_major_meter: 6378137, inv_flattening: 298.257223563,
725
725
  prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0,
726
726
  angular_units: "Degree", angular_units_conv: 0.0174532925199433,
@@ -732,7 +732,7 @@ class CrsTest < AbstractTest
732
732
 
733
733
  def test_geocentric_datum
734
734
  context = Proj::Context.new
735
- crs = Proj::Crs.create_geocentric(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellps_name: "WGS 84",
735
+ crs = Proj::Crs.create_geocentric(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellipsoid_name: "WGS 84",
736
736
  semi_major_meter: 6378137, inv_flattening: 298.257223563,
737
737
  prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0,
738
738
  angular_units: "Degree", angular_units_conv: 0.0174532925199433,
@@ -791,9 +791,9 @@ class CrsTest < AbstractTest
791
791
  context = Proj::Context.new
792
792
  coordinate_system = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LONGITUDE_LATITUDE, context)
793
793
 
794
- horizontal_crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellps_name: "WGS 84",
794
+ horizontal_crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellipsoid_name: "WGS 84",
795
795
  semi_major_meter: 6378137, inv_flattening: 298.257223563,
796
- prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_units_conv: 0.0174532925199433,
796
+ prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_angular_units_conv: 0.0174532925199433,
797
797
  coordinate_system: coordinate_system)
798
798
 
799
799
  vertical_crs = Proj::Crs.create_vertical(context, name: "myVertCRS",
@@ -860,9 +860,9 @@ class CrsTest < AbstractTest
860
860
 
861
861
  coordinate_system = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LONGITUDE_LATITUDE, context)
862
862
  crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984",
863
- ellps_name: "WGS 84", semi_major_meter: 6378137, inv_flattening: 298.257223563,
863
+ ellipsoid_name: "WGS 84", semi_major_meter: 6378137, inv_flattening: 298.257223563,
864
864
  prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0,
865
- pm_angular_units: "Degree", pm_units_conv: 0.0174532925199433,
865
+ pm_angular_units: "Degree", pm_angular_units_conv: 0.0174532925199433,
866
866
  coordinate_system: coordinate_system)
867
867
 
868
868
  cartesian = Proj::CoordinateSystem.create_cartesian_2d(context, :PJ_CART2D_EASTING_NORTHING)
@@ -940,9 +940,9 @@ class CrsTest < AbstractTest
940
940
  context = Proj::Context.new
941
941
  coordinate_system = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LATITUDE_LONGITUDE, context)
942
942
 
943
- crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellps_name: "WGS 84",
943
+ crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellipsoid_name: "WGS 84",
944
944
  semi_major_meter: 6378137, inv_flattening: 298.257223563,
945
- prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_units_conv: 0.0174532925199433,
945
+ prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_angular_units_conv: 0.0174532925199433,
946
946
  coordinate_system: coordinate_system)
947
947
  assert_equal("WGS 84", crs.name)
948
948
 
@@ -955,9 +955,9 @@ class CrsTest < AbstractTest
955
955
  context = Proj::Context.new
956
956
  coordinate_system = Proj::CoordinateSystem.create_ellipsoidal_2d(:PJ_ELLPS2D_LATITUDE_LONGITUDE, context)
957
957
 
958
- crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellps_name: "WGS 84",
958
+ crs = Proj::Crs.create_geographic(context, name: "WGS 84", datum_name: "World Geodetic System 1984", ellipsoid_name: "WGS 84",
959
959
  semi_major_meter: 6378137, inv_flattening: 298.257223563,
960
- prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_units_conv: 0.0174532925199433,
960
+ prime_meridian_name: "Greenwich", prime_meridian_offset: 0.0, pm_angular_units: "Degree", pm_angular_units_conv: 0.0174532925199433,
961
961
  coordinate_system: coordinate_system)
962
962
  refute(crs.auth)
963
963
 
@@ -108,7 +108,7 @@ class DatabaseTest < AbstractTest
108
108
  assert_equal("EPSG", crs_info.auth_name)
109
109
  assert_equal("2000", crs_info.code)
110
110
  assert_equal("Anguilla 1957 / British West Indies Grid", crs_info.name)
111
- assert_equal(:PJ_TYPE_PROJECTED_CRS, crs_info.type)
111
+ assert_equal(:PJ_TYPE_PROJECTED_CRS, crs_info.crs_type)
112
112
  refute(crs_info.deprecated)
113
113
  assert(crs_info.bbox_valid)
114
114
  assert_equal(-63.22, crs_info.west_lon_degree)
@@ -26,37 +26,37 @@ class TransformationTest < AbstractTest
26
26
  source_crs = Proj::Crs.create_geographic(context,
27
27
  name: "Source CRS",
28
28
  datum_name: "World Geodetic System 1984",
29
- ellps_name: "WGS 84",
29
+ ellipsoid_name: "WGS 84",
30
30
  semi_major_meter: 6378137,
31
31
  inv_flattening: 298.257223563,
32
32
  prime_meridian_name: "Greenwich",
33
33
  prime_meridian_offset: 0.0,
34
34
  pm_angular_units: "Degree",
35
- pm_units_conv: 0.0174532925199433,
35
+ pm_angular_units_conv: 0.0174532925199433,
36
36
  coordinate_system: coordinate_system)
37
37
 
38
38
  target_crs = Proj::Crs.create_geographic(context,
39
39
  name: "WGS 84",
40
40
  datum_name: "World Geodetic System 1984",
41
- ellps_name: "WGS 84",
41
+ ellipsoid_name: "WGS 84",
42
42
  semi_major_meter: 6378137,
43
43
  inv_flattening: 298.257223563,
44
44
  prime_meridian_name: "Greenwich",
45
45
  prime_meridian_offset: 0.0,
46
46
  pm_angular_units: "Degree",
47
- pm_units_conv: 0.0174532925199433,
47
+ pm_angular_units_conv: 0.0174532925199433,
48
48
  coordinate_system: coordinate_system)
49
49
 
50
50
  interp_crs = Proj::Crs.create_geographic(context,
51
51
  name: "Interpolation CRS",
52
52
  datum_name: "World Geodetic System 1984",
53
- ellps_name: "WGS 84",
53
+ ellipsoid_name: "WGS 84",
54
54
  semi_major_meter: 6378137,
55
55
  inv_flattening: 298.257223563,
56
56
  prime_meridian_name: "Greenwich",
57
57
  prime_meridian_offset: 0.0,
58
58
  pm_angular_units: "Degree",
59
- pm_units_conv: 0.0174532925199433,
59
+ pm_angular_units_conv: 0.0174532925199433,
60
60
  coordinate_system: coordinate_system)
61
61
 
62
62
  param = Proj::Parameter.new(name: "param name", value: 0.99,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proj4rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilhem Vellut
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  requirements:
191
191
  - Proj Library
192
- rubygems_version: 3.4.6
192
+ rubygems_version: 3.4.8
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: Ruby bindings for the Proj coordinate transformation library