proj4rb 3.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +32 -15
  3. data/README.rdoc +82 -44
  4. data/Rakefile +27 -27
  5. data/lib/api/api.rb +117 -118
  6. data/lib/api/api_5_0.rb +337 -300
  7. data/lib/api/api_5_1.rb +6 -6
  8. data/lib/api/api_5_2.rb +4 -4
  9. data/lib/api/api_6_0.rb +118 -14
  10. data/lib/api/api_6_1.rb +4 -4
  11. data/lib/api/api_6_2.rb +9 -6
  12. data/lib/api/api_6_3.rb +6 -0
  13. data/lib/api/api_7_0.rb +69 -0
  14. data/lib/api/api_7_1.rb +73 -0
  15. data/lib/api/api_7_2.rb +14 -0
  16. data/lib/api/api_8_0.rb +6 -0
  17. data/lib/api/api_8_1.rb +24 -0
  18. data/lib/api/api_8_2.rb +6 -0
  19. data/lib/api/api_9_1.rb +7 -0
  20. data/lib/api/api_9_2.rb +9 -0
  21. data/lib/api/api_experimental.rb +201 -0
  22. data/lib/proj/area.rb +74 -32
  23. data/lib/proj/axis_info.rb +44 -0
  24. data/lib/proj/bounds.rb +13 -0
  25. data/lib/proj/context.rb +175 -28
  26. data/lib/proj/conversion.rb +91 -0
  27. data/lib/proj/coordinate.rb +281 -197
  28. data/lib/proj/coordinate_operation_mixin.rb +381 -0
  29. data/lib/proj/coordinate_system.rb +137 -0
  30. data/lib/proj/crs.rb +672 -204
  31. data/lib/proj/crs_info.rb +47 -0
  32. data/lib/proj/database.rb +305 -0
  33. data/lib/proj/datum.rb +32 -0
  34. data/lib/proj/datum_ensemble.rb +34 -0
  35. data/lib/proj/ellipsoid.rb +77 -41
  36. data/lib/proj/error.rb +62 -9
  37. data/lib/proj/file_api.rb +166 -0
  38. data/lib/proj/grid.rb +121 -0
  39. data/lib/proj/grid_cache.rb +64 -0
  40. data/lib/proj/grid_info.rb +19 -0
  41. data/lib/proj/network_api.rb +92 -0
  42. data/lib/proj/operation.rb +42 -42
  43. data/lib/proj/operation_factory_context.rb +137 -0
  44. data/lib/proj/parameter.rb +38 -0
  45. data/lib/proj/parameters.rb +107 -0
  46. data/lib/proj/pj_object.rb +670 -80
  47. data/lib/proj/pj_objects.rb +45 -0
  48. data/lib/proj/prime_meridian.rb +65 -39
  49. data/lib/proj/projection.rb +698 -207
  50. data/lib/proj/session.rb +47 -0
  51. data/lib/proj/strings.rb +32 -0
  52. data/lib/proj/transformation.rb +101 -60
  53. data/lib/proj/unit.rb +108 -53
  54. data/lib/proj.rb +114 -9
  55. data/proj4rb.gemspec +5 -5
  56. data/test/abstract_test.rb +23 -1
  57. data/test/context_test.rb +172 -82
  58. data/test/conversion_test.rb +368 -0
  59. data/test/coordinate_system_test.rb +144 -0
  60. data/test/crs_test.rb +770 -71
  61. data/test/database_test.rb +360 -0
  62. data/test/datum_ensemble_test.rb +65 -0
  63. data/test/datum_test.rb +55 -0
  64. data/test/ellipsoid_test.rb +64 -18
  65. data/test/file_api_test.rb +66 -0
  66. data/test/grid_cache_test.rb +72 -0
  67. data/test/grid_test.rb +141 -0
  68. data/test/network_api_test.rb +45 -0
  69. data/test/operation_factory_context_test.rb +201 -0
  70. data/test/parameters_test.rb +40 -0
  71. data/test/pj_object_test.rb +179 -0
  72. data/test/prime_meridian_test.rb +76 -0
  73. data/test/proj_test.rb +46 -4
  74. data/test/projection_test.rb +646 -222
  75. data/test/session_test.rb +78 -0
  76. data/test/transformation_test.rb +149 -7
  77. data/test/unit_test.rb +57 -28
  78. metadata +51 -13
  79. data/lib/api/api_4_9.rb +0 -31
  80. data/lib/proj/config.rb +0 -70
  81. data/lib/proj/point.rb +0 -72
  82. data/test/prime_meridians_test.rb +0 -33
data/lib/api/api_5_1.rb CHANGED
@@ -1,7 +1,7 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_log_level, [:PJ_CONTEXT, :PJ_LOG_LEVEL], :PJ_LOG_LEVEL
4
- callback :pj_log_function, [:pointer, :int, :string], :void
5
- attach_function :proj_log_func, [:PJ_CONTEXT, :pointer, :pj_log_function], :void
6
- end
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_log_level, [:PJ_CONTEXT, PJ_LOG_LEVEL], PJ_LOG_LEVEL
4
+ callback :pj_log_function, [:pointer, :int, :string], :void
5
+ attach_function :proj_log_func, [:PJ_CONTEXT, :pointer, :pj_log_function], :void
6
+ end
7
7
  end
data/lib/api/api_5_2.rb CHANGED
@@ -1,5 +1,5 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_errno_string, [:int], :string
4
- end
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_errno_string, [:int], :string
4
+ end
5
5
  end
data/lib/api/api_6_0.rb CHANGED
@@ -1,30 +1,116 @@
1
1
  module Proj
2
2
  module Api
3
- callback :proj_file_finder, [:PJ_CONTEXT, :string, :pointer], :pointer
4
- attach_function :proj_context_set_file_finder, [:PJ_CONTEXT, :proj_file_finder, :pointer], :void
5
- attach_function :proj_context_set_search_paths, [:PJ_CONTEXT, :int, :pointer], :void
3
+ # Comparison criteria
4
+ # @return [Symbol]
5
+ PJ_COMPARISON_CRITERION = enum(:PJ_COMP_STRICT, # All properties are identical
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.
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
6
8
 
7
- attach_function :proj_context_use_proj4_init_rules, [:PJ_CONTEXT, :int], :void
8
- attach_function :proj_context_get_use_proj4_init_rules, [:PJ_CONTEXT, :int], :bool
9
- attach_function :proj_list_angular_units, [], :pointer #PJ_UNITS
9
+ #Guessed WKT "dialect"
10
+ # @return [Symbol]
11
+ PJ_GUESSED_WKT_DIALECT = enum(:PJ_GUESSED_WKT2_2019,
12
+ :PJ_GUESSED_WKT2_2018,
13
+ :PJ_GUESSED_WKT2_2015,
14
+ :PJ_GUESSED_WKT1_GDAL,
15
+ :PJ_GUESSED_WKT1_ESRI,
16
+ :PJ_GUESSED_NOT_WKT)
10
17
 
11
18
  # Base methods
19
+ attach_function :proj_clone, [:PJ_CONTEXT, :PJ], :PJ
12
20
  attach_function :proj_get_name, [:PJ], :string
13
21
  attach_function :proj_get_id_auth_name, [:PJ, :int], :string
14
22
  attach_function :proj_get_id_code, [:PJ, :int], :string
15
- attach_function :proj_get_type, [:PJ], :PJ_TYPE
16
- attach_function :proj_is_deprecated, [:PJ], :bool
23
+ attach_function :proj_get_remarks, [:PJ], :string
24
+ attach_function :proj_get_scope, [:PJ], :string
25
+ attach_function :proj_get_type, [:PJ], PJ_TYPE
17
26
  attach_function :proj_is_crs, [:PJ], :bool
27
+ attach_function :proj_is_equivalent_to, [:PJ, :PJ, PJ_COMPARISON_CRITERION], :int
28
+ attach_function :proj_is_deprecated, [:PJ], :int
29
+ attach_function :proj_get_source_crs, [:PJ_CONTEXT, :PJ], :PJ
30
+ attach_function :proj_get_target_crs, [:PJ_CONTEXT, :PJ], :PJ
31
+
32
+ # Area
33
+ attach_function :proj_area_create, [], :PJ_AREA
34
+ attach_function :proj_area_set_bbox, [:PJ_AREA, :double, :double, :double, :double], :void
18
35
  attach_function :proj_get_area_of_use, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer, :pointer, :pointer], :bool
36
+ attach_function :proj_area_destroy, [:PJ_AREA], :void
19
37
 
20
38
  # Export to various formats
21
- attach_function :proj_as_wkt, [:PJ_CONTEXT, :PJ, :PJ_WKT_TYPE, :pointer], :string
22
- attach_function :proj_as_proj_string, [:PJ_CONTEXT, :PJ, :PJ_PROJ_STRING_TYPE, :pointer], :string
39
+ attach_function :proj_as_wkt, [:PJ_CONTEXT, :PJ, PJ_WKT_TYPE, :pointer], :string
40
+ attach_function :proj_as_proj_string, [:PJ_CONTEXT, :PJ, PJ_PROJ_STRING_TYPE, :pointer], :string
41
+
42
+ # String List
43
+ typedef :pointer, :PROJ_STRING_LIST
44
+ attach_function :proj_string_list_destroy, [:PROJ_STRING_LIST], :void
45
+
46
+ # ----- Object List
47
+ typedef :pointer, :PJ_OBJ_LIST
48
+
49
+ attach_function :proj_create_from_name, [:PJ_CONTEXT, :string, :string, :pointer, :size_t, :int, :size_t, :string], :PJ_OBJ_LIST
50
+ attach_function :proj_get_non_deprecated, [:PJ_CONTEXT, :PJ], :PJ_OBJ_LIST
51
+ attach_function :proj_identify, [:PJ_CONTEXT, :PJ, :string, :pointer, :pointer], :PJ_OBJ_LIST
52
+ attach_function :proj_list_get_count, [:PJ_OBJ_LIST], :int
53
+ attach_function :proj_list_get, [:PJ_CONTEXT, :PJ_OBJ_LIST, :int], :PJ
54
+ attach_function :proj_list_destroy, [:PJ_OBJ_LIST], :void
55
+
56
+ callback :proj_file_finder, [:PJ_CONTEXT, :string, :pointer], :pointer
57
+ attach_function :proj_context_set_file_finder, [:PJ_CONTEXT, :proj_file_finder, :pointer], :void
58
+ attach_function :proj_context_set_search_paths, [:PJ_CONTEXT, :int, :pointer], :void
59
+
60
+ attach_function :proj_list_angular_units, [], :pointer #PJ_UNITS
23
61
 
24
- # Projection database functions
62
+ # Contains description of a CRS
63
+ class PROJ_CRS_INFO < FFI::Struct
64
+ fields = [:auth_name, :string, # Authority name
65
+ :code, :string, # Object code
66
+ :name, :string, # Object name
67
+ :type, PJ_TYPE, # Object type
68
+ :deprecated, :int, # Whether the object is deprecated
69
+ :bbox_valid, :int, # Whether bbox values in degrees are valid
70
+ :west_lon_degree, :double, # Western-most longitude of the area of use, in degrees.
71
+ :south_lat_degree, :double, # Southern-most latitude of the area of use, in degrees.
72
+ :east_lon_degree, :double, # Eastern-most longitude of the area of use, in degrees.
73
+ :north_lat_degree, :double, # Northern-most latitude of the area of use, in degrees.
74
+ :area_name, :string, # Name of the area of use
75
+ :projection_method_name, :string] # Name of the projection method for a projected CRS. Might be NULL even for projected CRS in some cases.
76
+
77
+ if Api::PROJ_VERSION >= Gem::Version.new('8.1.0')
78
+ fields += [:celestial_body_name, :string] # Name of the celestial body of the CRS (e.g. "Earth")
79
+ end
80
+ layout(*fields)
81
+ end
82
+
83
+ attach_function :proj_crs_info_list_destroy, [:pointer], :void
84
+
85
+ # Structure describing optional parameters for proj_get_crs_list
86
+ class PROJ_CRS_LIST_PARAMETERS < FFI::Struct
87
+ fields = [:types, :pointer, # Array of allowed object types. Should be nil if all types are allowed
88
+ :types_count, :size_t, # Size of types. Should be 0 if all types are allowed
89
+ :crs_area_of_use_contains_bbox, :int, # If TRUE and bbox_valid == TRUE, then only CRS whose area of use entirely contains the specified bounding box will be returned. If FALSE and bbox_valid == TRUE, then only CRS whose area of use intersects the specified bounding box will be returned
90
+ :bbox_valid, :int, # To set to TRUE so that west_lon_degree, south_lat_degree, east_lon_degree and north_lat_degree fields are taken into account
91
+ :west_lon_degree, :double, # Western-most longitude of the area of use, in degrees.
92
+ :south_lat_degree, :double, # Southern-most latitude of the area of use, in degrees.
93
+ :east_lon_degree, :double, # Eastern-most longitude of the area of use, in degrees.
94
+ :north_lat_degree, :double,# Northern-most latitude of the area of use, in degrees.
95
+ :allow_deprecated, :int] # Whether deprecated objects are allowed. Default to False
96
+
97
+ if Api::PROJ_VERSION >= Gem::Version.new('8.1.0')
98
+ fields += [:celestial_body_name, :pointer] #Name of the celestial body of the CRS (e.g. "Earth")
99
+ end
100
+ layout(*fields)
101
+ end
102
+
103
+ attach_function :proj_get_crs_list_parameters_create, [], :pointer
104
+ attach_function :proj_get_crs_list_parameters_destroy, [:pointer], :void
105
+
106
+ # Database functions
25
107
  attach_function :proj_context_set_database_path, [:PJ_CONTEXT, :string, :pointer, :pointer], :int
26
108
  attach_function :proj_context_get_database_path, [:PJ_CONTEXT], :string
27
109
  attach_function :proj_context_get_database_metadata, [:PJ_CONTEXT, :string], :string
110
+ attach_function :proj_get_authorities_from_database, [:PJ_CONTEXT], :PROJ_STRING_LIST
111
+ attach_function :proj_get_codes_from_database, [:PJ_CONTEXT, :string, PJ_TYPE, :int], :PROJ_STRING_LIST
112
+ attach_function :proj_get_crs_info_list_from_database, [:PJ_CONTEXT, :string, PROJ_CRS_LIST_PARAMETERS, :pointer], PROJ_CRS_INFO
113
+ attach_function :proj_uom_get_info_from_database, [:PJ_CONTEXT, :string, :string, :pointer, :pointer, :pointer], :int
28
114
 
29
115
  # CRS methods
30
116
  attach_function :proj_crs_get_geodetic_crs, [:PJ_CONTEXT, :PJ], :PJ
@@ -32,11 +118,29 @@ module Proj
32
118
  attach_function :proj_crs_get_sub_crs, [:PJ_CONTEXT, :PJ, :int], :PJ
33
119
  attach_function :proj_crs_get_datum, [:PJ_CONTEXT, :PJ], :PJ
34
120
  attach_function :proj_crs_get_coordinate_system, [:PJ_CONTEXT, :PJ], :PJ
35
- attach_function :proj_cs_get_type, [:PJ_CONTEXT, :PJ], :PJ_COORDINATE_SYSTEM_TYPE
121
+ attach_function :proj_cs_get_type, [:PJ_CONTEXT, :PJ], PJ_COORDINATE_SYSTEM_TYPE
36
122
  attach_function :proj_cs_get_axis_count, [:PJ_CONTEXT, :PJ], :int
37
123
  attach_function :proj_cs_get_axis_info, [:PJ_CONTEXT, :PJ, :int, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :bool
38
- attach_function :proj_get_prime_meridian, [:PJ_CONTEXT, :PJ], :PJ
39
- attach_function :proj_get_ellipsoid, [:PJ_CONTEXT, :PJ], :PJ
40
124
  attach_function :proj_crs_get_coordoperation, [:PJ_CONTEXT, :PJ], :PJ
125
+ attach_function :proj_coordoperation_get_accuracy, [:PJ_CONTEXT, :PJ], :double
126
+ attach_function :proj_coordoperation_get_method_info, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer], :int
127
+ attach_function :proj_coordoperation_get_towgs84_values, [:PJ_CONTEXT, :PJ, :pointer, :int, :int], :int
128
+ attach_function :proj_concatoperation_get_step_count, [:PJ_CONTEXT, :PJ], :int
129
+ attach_function :proj_concatoperation_get_step, [:PJ_CONTEXT, :PJ, :int], :PJ
130
+
131
+ attach_function :proj_get_ellipsoid, [:PJ_CONTEXT, :PJ], :PJ
132
+ attach_function :proj_ellipsoid_get_parameters, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer, :pointer], :int
133
+
134
+ attach_function :proj_get_prime_meridian, [:PJ_CONTEXT, :PJ], :PJ
135
+ attach_function :proj_prime_meridian_get_parameters, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer], :int
136
+
137
+ # ISO-19111
138
+ attach_function :proj_create_from_wkt, [:PJ_CONTEXT, :string, :pointer, :PROJ_STRING_LIST, :PROJ_STRING_LIST], :PJ
139
+ attach_function :proj_create_from_database, [:PJ_CONTEXT, :string, :string, PJ_CATEGORY, :int, :pointer], :PJ
140
+ attach_function :proj_context_guess_wkt_dialect, [:PJ_CONTEXT, :string], PJ_GUESSED_WKT_DIALECT
141
+
142
+ # Undocumented apis
143
+ attach_function :proj_context_use_proj4_init_rules, [:PJ_CONTEXT, :int], :void
144
+ attach_function :proj_context_get_use_proj4_init_rules, [:PJ_CONTEXT, :int], :int
41
145
  end
42
146
  end
data/lib/api/api_6_1.rb CHANGED
@@ -1,5 +1,5 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_normalize_for_visualization, [:PJ_CONTEXT, :PJ], :PJ
4
- end
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_normalize_for_visualization, [:PJ_CONTEXT, :PJ], :PJ
4
+ end
5
5
  end
data/lib/api/api_6_2.rb CHANGED
@@ -1,7 +1,10 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_as_projjson, [:PJ_CONTEXT, :PJ, :pointer], :string
4
- attach_function :proj_create_crs_to_crs_from_pj, [:PJ_CONTEXT, :PJ, :PJ, :PJ_AREA, :string], :PJ
5
- attach_function :proj_context_set_autoclose_database, [:PJ_CONTEXT, :int], :void
6
- end
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_cleanup, [], :void
4
+ attach_function :proj_as_projjson, [:PJ_CONTEXT, :PJ, :pointer], :string
5
+ attach_function :proj_create_crs_to_crs_from_pj, [:PJ_CONTEXT, :PJ, :PJ, :PJ_AREA, :pointer], :PJ
6
+ attach_function :proj_grid_get_info_from_database, [:PJ_CONTEXT, :string, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :int
7
+ attach_function :proj_context_set_autoclose_database, [:PJ_CONTEXT, :int], :void
8
+ attach_function :proj_operation_factory_context_set_discard_superseded, [:PJ_CONTEXT, :pointer, :int], :void
9
+ end
7
10
  end
@@ -0,0 +1,6 @@
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_is_equivalent_to_with_ctx, [:PJ_CONTEXT, :PJ, :PJ, PJ_COMPARISON_CRITERION], :int
4
+ attach_function :proj_coordoperation_create_inverse, [:PJ_CONTEXT, :PJ], :PJ
5
+ end
6
+ end
@@ -0,0 +1,69 @@
1
+ module Proj
2
+ module Api
3
+ # ---- File API ----------
4
+ typedef :pointer, :PROJ_FILE_HANDLE
5
+ typedef :pointer, :USER_DATA
6
+
7
+ # @return [Symbol]
8
+ PROJ_OPEN_ACCESS = enum(:PROJ_OPEN_ACCESS_READ_ONLY, # Read-only access. Equivalent to "rb"
9
+ :PROJ_OPEN_ACCESS_READ_UPDATE, # Read-update access. File should be created if not existing. Equivalent to "r+b
10
+ :PROJ_OPEN_ACCESS_CREATE) # Create access. File should be truncated to 0-byte if already existing. Equivalent to "w+b"
11
+
12
+ # File API callbacks
13
+ callback :open_file_cbk, [:PJ_CONTEXT, :string, PROJ_OPEN_ACCESS, :USER_DATA], :PROJ_FILE_HANDLE
14
+ callback :read_file_cbk, [:PJ_CONTEXT, :PROJ_FILE_HANDLE, :pointer, :size_t, :USER_DATA], :size_t
15
+ callback :write_file_cbk, [:PJ_CONTEXT, :PROJ_FILE_HANDLE, :pointer, :size_t, :USER_DATA], :size_t
16
+ callback :seek_file_cbk, [:PJ_CONTEXT, :PROJ_FILE_HANDLE, :long_long, :int, :USER_DATA], :int
17
+ callback :tell_file_cbk, [:PJ_CONTEXT, :PROJ_FILE_HANDLE, :USER_DATA], :long_long
18
+ callback :close_file_cbk, [:PJ_CONTEXT, :PROJ_FILE_HANDLE, :USER_DATA], :void
19
+ callback :exists_file_cbk, [:PJ_CONTEXT, :string, :USER_DATA], :int
20
+ callback :mkdir_file_cbk, [:PJ_CONTEXT, :string, :USER_DATA], :int
21
+ callback :unlink_file_cbk, [:PJ_CONTEXT, :string, :USER_DATA], :int
22
+ callback :rename_file_cbk, [:PJ_CONTEXT, :string, :string, :USER_DATA], :int
23
+
24
+ # Progress callback. The passed percentage is in the range [0, 1]. The progress callback must return
25
+ # TRUE if the download should be continued.
26
+ callback :progress_file_cbk, [:PJ_CONTEXT, :double, :USER_DATA], :int
27
+
28
+ class PROJ_FILE_API < FFI::Struct
29
+ layout :version, :int, # Version of this structure. Should be set to 1 currently.
30
+ :open_cbk, :open_file_cbk,
31
+ :read_cbk, :read_file_cbk,
32
+ :write_cbk, :write_file_cbk,
33
+ :seek_cbk, :seek_file_cbk,
34
+ :tell_cbk, :tell_file_cbk,
35
+ :close_cbk, :close_file_cbk,
36
+ :exists_cbk, :exists_file_cbk,
37
+ :mkdir_cbk, :mkdir_file_cbk,
38
+ :unlink_cbk, :unlink_file_cbk,
39
+ :rename_cbk, :rename_file_cbk
40
+ end
41
+ attach_function :proj_context_set_fileapi, [:PJ_CONTEXT, PROJ_FILE_API, :USER_DATA], :int
42
+ attach_function :proj_is_download_needed, [:PJ_CONTEXT, :string, :int], :int
43
+ attach_function :proj_download_file, [:PJ_CONTEXT, :string, :int, :progress_file_cbk, :USER_DATA], :int
44
+
45
+ # --------- Network API ------------
46
+ typedef :pointer, :PROJ_NETWORK_HANDLE
47
+ callback :open_network_cbk, [:PJ_CONTEXT, :string, :ulong_long, :size_t, :pointer, :pointer, :size_t, :string, :USER_DATA], :PROJ_NETWORK_HANDLE
48
+ callback :close_network_cbk, [:PJ_CONTEXT, :PROJ_NETWORK_HANDLE, :USER_DATA], :void
49
+ callback :header_value_cbk, [:PJ_CONTEXT, :PROJ_NETWORK_HANDLE, :pointer, :USER_DATA], :pointer
50
+ callback :read_range_cbk, [:PJ_CONTEXT, :PROJ_NETWORK_HANDLE, :ulong_long, :size_t, :pointer, :size_t, :string, :USER_DATA], :size_t
51
+ attach_function :proj_context_set_network_callbacks, [:PJ_CONTEXT, :open_network_cbk, :close_network_cbk, :header_value_cbk, :read_range_cbk, :pointer], :int
52
+
53
+ attach_function :proj_context_is_network_enabled, [:PJ_CONTEXT], :int
54
+ attach_function :proj_context_set_enable_network, [:PJ_CONTEXT, :int], :int
55
+ attach_function :proj_context_set_url_endpoint, [:PJ_CONTEXT, :string], :void
56
+
57
+ # --------- Cache ------------
58
+ attach_function :proj_grid_cache_set_enable, [:PJ_CONTEXT, :int], :void
59
+ attach_function :proj_grid_cache_set_filename, [:PJ_CONTEXT, :string], :void
60
+ attach_function :proj_grid_cache_set_max_size, [:PJ_CONTEXT, :int], :void
61
+ attach_function :proj_grid_cache_set_ttl, [:PJ_CONTEXT, :int], :void
62
+ attach_function :proj_grid_cache_clear, [:PJ_CONTEXT], :void
63
+
64
+ # -------- Other ----------
65
+ attach_function :proj_assign_context, [:PJ, :PJ_CONTEXT], :void
66
+ attach_function :proj_degree_input, [:PJ, PJ_DIRECTION], :int
67
+ attach_function :proj_degree_output, [:PJ, PJ_DIRECTION], :int
68
+ end
69
+ end
@@ -0,0 +1,73 @@
1
+ module Proj
2
+ module Api
3
+ # ----- Int List
4
+ attach_function :proj_int_list_destroy, [:pointer], :void
5
+
6
+ # ---- Units ------
7
+ class PROJ_UNIT_INFO < FFI::Struct
8
+ layout :auth_name, :string,
9
+ :code, :string,
10
+ :name, :string,
11
+ :category, :string,
12
+ :conv_factor, :double,
13
+ :proj_short_name, :string,
14
+ :deprecated, :int
15
+ end
16
+
17
+ attach_function :proj_get_units_from_database, [:PJ_CONTEXT, :string, :string, :int, :pointer], :pointer #Array of pointers to PROJ_UNIT_INFO
18
+ attach_function :proj_unit_list_destroy, [:pointer], :void
19
+
20
+ # ---- Operation Factories ------
21
+ # Specifies how source and target CRS extent should be used to restrict candidate
22
+ # operations (only taken into account if no explicit area of interest is specified.
23
+ enum :PROJ_CRS_EXTENT_USE, [:PJ_CRS_EXTENT_NONE, # Ignore CRS extent
24
+ :PJ_CRS_EXTENT_BOTH, # Test extent against both CRS extent.
25
+ :PJ_CRS_EXTENT_INTERSECTION, # Test extent against the intersection of both CRS extents
26
+ :PJ_CRS_EXTENT_SMALLEST] # Test against the smallest of both CRS extent
27
+
28
+
29
+ # Spatial criterion to restrict candidate operations
30
+ enum :PROJ_SPATIAL_CRITERION, [:PROJ_SPATIAL_CRITERION_STRICT_CONTAINMENT, # The area of validity of transforms should strictly contain the area of interest
31
+ :PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION] # The area of validity of transforms should at least intersect the area of interest
32
+
33
+ # Describe how grid availability is used
34
+ enum :PROJ_GRID_AVAILABILITY_USE, [:PROJ_GRID_AVAILABILITY_USE, # Grid availability is only used for sorting results. Operations where some grids are missing will be sorted last
35
+ :PROJ_GRID_AVAILABILITY_DISCARD_OPERATION_IF_MISSING_GRID, # Completely discard an operation if a required grid is missing
36
+ :PROJ_GRID_AVAILABILITY_IGNORED, # Ignore grid availability at all. Results will be presented as if all grids were available
37
+ :PROJ_GRID_AVAILABILITY_KNOWN_AVAILABLE] # Results will be presented as if grids known to PROJ (that is registered in the grid_alternatives table of its database) were available. Used typically when networking is enabled.
38
+
39
+ # Describe if and how intermediate CRS should be used
40
+ enum :PROJ_INTERMEDIATE_CRS_USE, [:PROJ_INTERMEDIATE_CRS_USE_ALWAYS, # Always search for intermediate CRS
41
+ :PROJ_INTERMEDIATE_CRS_USE_IF_NO_DIRECT_TRANSFORMATION, # Only attempt looking for intermediate CRS if there is no direct transformation available
42
+ :PROJ_INTERMEDIATE_CRS_USE_NEVER] # Do not attempt looking for intermediate CRS
43
+
44
+ attach_function :proj_create_operation_factory_context, [:PJ_CONTEXT, :string], :PJ_OBJ_LIST
45
+ attach_function :proj_operation_factory_context_destroy, [:pointer], :void
46
+ attach_function :proj_create_operations, [:PJ_CONTEXT, :PJ, :PJ, :pointer], :pointer
47
+ attach_function :proj_operation_factory_context_set_allow_ballpark_transformations, [:PJ_CONTEXT, :pointer, :int], :void
48
+ attach_function :proj_operation_factory_context_set_desired_accuracy, [:PJ_CONTEXT, :pointer, :double], :void
49
+ attach_function :proj_operation_factory_context_set_area_of_interest, [:PJ_CONTEXT, :pointer, :double, :double, :double, :double], :void
50
+ attach_function :proj_operation_factory_context_set_crs_extent_use, [:PJ_CONTEXT, :pointer, :PROJ_CRS_EXTENT_USE], :void
51
+ attach_function :proj_operation_factory_context_set_spatial_criterion, [:PJ_CONTEXT, :pointer, :PROJ_SPATIAL_CRITERION], :void
52
+ attach_function :proj_operation_factory_context_set_grid_availability_use, [:PJ_CONTEXT, :pointer, :PROJ_GRID_AVAILABILITY_USE], :void
53
+ attach_function :proj_operation_factory_context_set_use_proj_alternative_grid_names, [:PJ_CONTEXT, :pointer, :int], :void
54
+ attach_function :proj_operation_factory_context_set_allow_use_intermediate_crs, [:PJ_CONTEXT, :pointer, :PROJ_INTERMEDIATE_CRS_USE], :void
55
+ attach_function :proj_operation_factory_context_set_allowed_intermediate_crs, [:PJ_CONTEXT, :pointer, :pointer], :void
56
+
57
+ # Operations
58
+ attach_function :proj_coordoperation_has_ballpark_transformation, [:PJ_CONTEXT, :PJ], :int
59
+ attach_function :proj_get_suggested_operation, [:PJ_CONTEXT, :PJ_OBJ_LIST, PJ_DIRECTION, PJ_COORD], :int
60
+ attach_function :proj_coordoperation_get_param_count, [:PJ_CONTEXT, :PJ], :int
61
+ attach_function :proj_coordoperation_get_param_index, [:PJ_CONTEXT, :PJ, :string], :int
62
+ attach_function :proj_coordoperation_get_param, [:PJ_CONTEXT, :PJ, :int, :pointer, :pointer, :pointer,
63
+ :pointer, :pointer, :pointer, :pointer,:pointer, :pointer, :pointer], :int
64
+ attach_function :proj_coordoperation_is_instantiable, [:PJ_CONTEXT, :PJ], :int
65
+ attach_function :proj_coordoperation_get_grid_used_count, [:PJ_CONTEXT, :PJ], :int
66
+ attach_function :proj_coordoperation_get_grid_used, [:PJ_CONTEXT, :PJ, :int,
67
+ :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :int
68
+
69
+ # Network
70
+ attach_function :proj_context_get_url_endpoint, [:PJ_CONTEXT], :string
71
+ attach_function :proj_context_get_user_writable_directory, [:PJ_CONTEXT, :int], :string
72
+ end
73
+ end
@@ -0,0 +1,14 @@
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_context_clone, [:PJ_CONTEXT], :PJ_CONTEXT
4
+ attach_function :proj_context_set_ca_bundle_path, [:PJ_CONTEXT, :string], :void
5
+
6
+ # Datum ensembles
7
+ attach_function :proj_crs_get_datum_ensemble, [:PJ_CONTEXT, :PJ], :PJ
8
+ attach_function :proj_crs_get_datum_forced, [:PJ_CONTEXT, :PJ], :PJ
9
+ attach_function :proj_datum_ensemble_get_member_count, [:PJ_CONTEXT, :PJ], :int
10
+ attach_function :proj_datum_ensemble_get_accuracy, [:PJ_CONTEXT, :PJ], :double
11
+ attach_function :proj_datum_ensemble_get_member, [:PJ_CONTEXT, :PJ, :int], :PJ
12
+ attach_function :proj_dynamic_datum_get_frame_reference_epoch, [:PJ_CONTEXT, :PJ], :double
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_crs_is_derived, [:PJ_CONTEXT, :PJ], :int
4
+ attach_function :proj_context_errno_string, [:PJ_CONTEXT, :int], :string
5
+ end
6
+ end
@@ -0,0 +1,24 @@
1
+ module Proj
2
+ module Api
3
+ # Stores a description of a celestial body.
4
+ class ProjCelestialBodyInfo < FFI::Struct
5
+ layout :auth_name, :string,
6
+ :name, :string
7
+ end
8
+
9
+ attach_function :proj_context_get_database_structure, [:PJ_CONTEXT, :pointer], :PROJ_STRING_LIST
10
+ attach_function :proj_get_geoid_models_from_database, [:PJ_CONTEXT, :string, :string, :pointer], :PROJ_STRING_LIST
11
+ attach_function :proj_suggests_code_for, [:PJ_CONTEXT, :PJ, :string, :int, :pointer], :pointer
12
+ attach_function :proj_string_destroy, [:pointer], :void
13
+
14
+ attach_function :proj_get_celestial_body_list_from_database, [:PJ_CONTEXT, :string, :pointer], :pointer
15
+ attach_function :proj_get_celestial_body_name, [:PJ_CONTEXT, :PJ], :string
16
+ attach_function :proj_celestial_body_list_destroy, [:pointer], :void
17
+
18
+ typedef :pointer, :PJ_INSERT_SESSION
19
+ attach_function :proj_insert_object_session_create, [:PJ_CONTEXT], :PJ_INSERT_SESSION
20
+ attach_function :proj_insert_object_session_destroy, [:PJ_CONTEXT, :PJ_INSERT_SESSION], :void
21
+ attach_function :proj_get_insert_statements, [:PJ_CONTEXT, :PJ_INSERT_SESSION, :PJ, :string, :string, :int,
22
+ :pointer , :pointer], :PROJ_STRING_LIST
23
+ end
24
+ end
@@ -0,0 +1,6 @@
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_trans_bounds, [:PJ_CONTEXT, :PJ, PJ_DIRECTION, :double, :double, :double, :double,
4
+ :pointer, :pointer, :pointer, :pointer, :int], :int
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_trans_get_last_used_operation, [:PJ], :PJ
4
+ attach_function :proj_operation_factory_context_set_area_of_interest_name, [:PJ_CONTEXT, :pointer, :string], :void
5
+ attach_function :proj_area_set_name, [:PJ_AREA, :string], :void
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_rtodms2, [:pointer, :size_t, :double, :int, :int], :string
4
+ attach_function :proj_get_area_of_use_ex, [:PJ_CONTEXT, :PJ, :int, :pointer, :pointer, :pointer, :pointer, :pointer], :bool
5
+ attach_function :proj_get_domain_count, [:PJ], :int
6
+ attach_function :proj_get_scope_ex, [:PJ, :int], :string
7
+ attach_function :proj_coordinate_metadata_get_epoch, [:PJ_CONTEXT, :PJ], :double
8
+ end
9
+ end