ffi-gdal 0.0.4 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/Rakefile +12 -1
  4. data/TODO.md +11 -0
  5. data/ffi-gdal.gemspec +2 -2
  6. data/lib/ext/error_symbols.rb +59 -0
  7. data/lib/ext/float_ext.rb +15 -0
  8. data/lib/ext/narray_ext.rb +16 -0
  9. data/lib/ext/to_bool.rb +2 -0
  10. data/lib/ffi-gdal.rb +139 -4
  11. data/lib/ffi/{gdal/cpl_conv.rb → cpl/conv_h.rb} +2 -3
  12. data/lib/ffi/{gdal/cpl_error.rb → cpl/error_h.rb} +1 -25
  13. data/lib/ffi/cpl/minixml_h.rb +14 -0
  14. data/lib/ffi/{gdal/cpl_string.rb → cpl/string_h.rb} +0 -25
  15. data/lib/ffi/{gdal/cpl_vsi.rb → cpl/vsi_h.rb} +0 -0
  16. data/lib/ffi/cpl/xml_node.rb +13 -0
  17. data/lib/ffi/gdal.rb +57 -593
  18. data/lib/ffi/gdal/alg_h.rb +127 -0
  19. data/lib/ffi/gdal/gdal_grid_data_metrics_options.rb +14 -0
  20. data/lib/ffi/gdal/gdal_grid_inverse_distance_to_a_power_options.rb +19 -0
  21. data/lib/ffi/gdal/gdal_grid_moving_average_options.rb +14 -0
  22. data/lib/ffi/gdal/gdal_grid_nearest_neighbor_options.rb +13 -0
  23. data/lib/ffi/gdal/gdal_h.rb +683 -0
  24. data/lib/ffi/gdal/gdal_rpc_info.rb +27 -0
  25. data/lib/ffi/gdal/gdal_transformer_info.rb +14 -0
  26. data/lib/ffi/gdal/gdal_warp_options.rb +43 -0
  27. data/lib/ffi/gdal/grid_h.rb +51 -0
  28. data/lib/ffi/gdal/version.rb +1 -1
  29. data/lib/ffi/gdal/warper_h.rb +48 -0
  30. data/lib/ffi/ogr.rb +12 -0
  31. data/lib/ffi/ogr/api_h.rb +553 -0
  32. data/lib/ffi/ogr/core_h.rb +148 -0
  33. data/lib/ffi/ogr/featurestyle_h.rb +22 -0
  34. data/lib/ffi/ogr/geocoding_h.rb +21 -0
  35. data/lib/ffi/ogr/ogr_contour_writer_info.rb +14 -0
  36. data/lib/ffi/ogr/ogr_envelope.rb +12 -0
  37. data/lib/ffi/ogr/ogr_envelope_3d.rb +14 -0
  38. data/lib/ffi/ogr/ogr_field.rb +50 -0
  39. data/lib/ffi/ogr/ogr_style_param.rb +12 -0
  40. data/lib/ffi/ogr/ogr_style_value.rb +13 -0
  41. data/lib/ffi/ogr/srs_api_h.rb +325 -0
  42. data/lib/gdal/color_entry.rb +47 -0
  43. data/lib/gdal/color_entry_extensions.rb +30 -0
  44. data/lib/gdal/color_interpretation.rb +15 -0
  45. data/lib/gdal/color_table.rb +146 -0
  46. data/lib/gdal/color_table_extensions.rb +47 -0
  47. data/lib/gdal/color_table_types/cmyk.rb +25 -0
  48. data/lib/gdal/color_table_types/gray.rb +9 -0
  49. data/lib/gdal/color_table_types/hls.rb +21 -0
  50. data/lib/gdal/color_table_types/rgb.rb +25 -0
  51. data/lib/gdal/data_type.rb +38 -0
  52. data/lib/gdal/dataset.rb +437 -0
  53. data/lib/gdal/dataset_extensions.rb +496 -0
  54. data/lib/gdal/driver.rb +244 -0
  55. data/lib/gdal/driver_extensions.rb +56 -0
  56. data/lib/gdal/environment_methods.rb +43 -0
  57. data/lib/{ffi-gdal → gdal}/exceptions.rb +4 -1
  58. data/lib/gdal/geo_transform.rb +188 -0
  59. data/lib/gdal/geo_transform_extensions.rb +90 -0
  60. data/lib/gdal/logger.rb +7 -0
  61. data/lib/{ffi-gdal → gdal}/major_object.rb +15 -14
  62. data/lib/gdal/options.rb +49 -0
  63. data/lib/gdal/raster_attribute_table.rb +185 -0
  64. data/lib/gdal/raster_attribute_table_extensions.rb +40 -0
  65. data/lib/{ffi-gdal → gdal}/raster_band.rb +227 -99
  66. data/lib/gdal/raster_band_extensions.rb +198 -0
  67. data/lib/{ffi-gdal → gdal}/version_info.rb +8 -0
  68. data/lib/gdal/warp_operation.rb +96 -0
  69. data/lib/ogr/coordinate_transformation.rb +108 -0
  70. data/lib/ogr/data_source.rb +172 -0
  71. data/lib/ogr/data_source_extensions.rb +32 -0
  72. data/lib/ogr/driver.rb +119 -0
  73. data/lib/ogr/envelope.rb +80 -0
  74. data/lib/ogr/envelope_extensions.rb +92 -0
  75. data/lib/ogr/exceptions.rb +35 -0
  76. data/lib/ogr/feature.rb +212 -0
  77. data/lib/ogr/feature_definition.rb +120 -0
  78. data/lib/ogr/feature_definition_extensions.rb +36 -0
  79. data/lib/ogr/feature_extensions.rb +31 -0
  80. data/lib/ogr/field.rb +91 -0
  81. data/lib/ogr/field_extensions.rb +23 -0
  82. data/lib/ogr/geocoding_session.rb +84 -0
  83. data/lib/ogr/geometry.rb +617 -0
  84. data/lib/ogr/geometry_extensions.rb +60 -0
  85. data/lib/ogr/geometry_types/collection.rb +45 -0
  86. data/lib/ogr/geometry_types/curve.rb +120 -0
  87. data/lib/ogr/geometry_types/surface.rb +20 -0
  88. data/lib/ogr/layer.rb +226 -0
  89. data/lib/ogr/layer_extensions.rb +55 -0
  90. data/lib/ogr/line_string.rb +7 -0
  91. data/lib/ogr/linear_ring.rb +6 -0
  92. data/lib/ogr/multi_line_string.rb +9 -0
  93. data/lib/ogr/multi_point.rb +7 -0
  94. data/lib/ogr/multi_polygon.rb +14 -0
  95. data/lib/ogr/point.rb +89 -0
  96. data/lib/ogr/polygon.rb +9 -0
  97. data/lib/ogr/spatial_reference.rb +723 -0
  98. data/lib/ogr/spatial_reference_extensions.rb +32 -0
  99. data/lib/ogr/style_table.rb +17 -0
  100. data/lib/ogr/style_table_extensions.rb +16 -0
  101. data/spec/{ffi-gdal/integration → integration}/color_table_info_spec.rb +1 -1
  102. data/spec/{ffi-gdal/integration → integration}/dataset_info_spec.rb +0 -0
  103. data/spec/{ffi-gdal/integration → integration}/driver_info_spec.rb +1 -1
  104. data/spec/{ffi-gdal/integration → integration}/geo_transform_info_spec.rb +0 -0
  105. data/spec/{ffi-gdal/integration → integration}/raster_attribute_table_info_spec.rb +1 -1
  106. data/spec/{ffi-gdal/integration → integration}/raster_band_info_spec.rb +5 -5
  107. data/spec/spec_helper.rb +4 -1
  108. data/spec/support/shapefiles/states_21basic/states.prj +1 -0
  109. data/spec/support/shapefiles/states_21basic/states.sbn +0 -0
  110. data/spec/support/shapefiles/states_21basic/states.sbx +0 -0
  111. data/spec/support/shapefiles/states_21basic/states.shp +0 -0
  112. data/spec/support/worldfiles/SR_50M/SR_50M.VERSION.txt +1 -0
  113. data/spec/support/worldfiles/SR_50M/SR_50M.prj +1 -0
  114. data/spec/support/worldfiles/SR_50M/SR_50M.tfw +6 -0
  115. data/spec/{ext/cpl_error_symbols_spec.rb → unit/ext/error_symbols_spec.rb} +1 -1
  116. data/spec/unit/gdal/color_table_spec.rb +146 -0
  117. data/spec/unit/ogr/layer_spec.rb +97 -0
  118. data/spec/unit/ogr/linear_ring_spec.rb +111 -0
  119. data/spec/unit/ogr/point_spec.rb +321 -0
  120. data/spec/{ffi-gdal/unit → unit}/version_info_spec.rb +1 -1
  121. data/testing_gdal.rb +168 -0
  122. data/testing_gdalwarp.rb +91 -0
  123. data/testing_layer_to_layer.rb +35 -0
  124. data/testing_ndvi.rb +76 -0
  125. data/testing_nir.rb +77 -0
  126. data/testing_ogr.rb +63 -0
  127. metadata +167 -59
  128. data/lib/ext/cpl_error_symbols.rb +0 -37
  129. data/lib/ffi-gdal/color_table.rb +0 -59
  130. data/lib/ffi-gdal/dataset.rb +0 -359
  131. data/lib/ffi-gdal/driver.rb +0 -151
  132. data/lib/ffi-gdal/geo_transform.rb +0 -137
  133. data/lib/ffi-gdal/raster_attribute_table.rb +0 -78
  134. data/lib/ffi/gdal/ogr_api.rb +0 -21
  135. data/lib/ffi/gdal/ogr_core.rb +0 -195
  136. data/lib/ffi/gdal/ogr_srs_api.rb +0 -44
  137. data/meow.rb +0 -144
  138. data/rubby.rb +0 -224
@@ -0,0 +1,127 @@
1
+ require 'ffi'
2
+ require_relative 'gdal_rpc_info'
3
+ require_relative '../ogr/api_h'
4
+
5
+ module FFI
6
+ module GDAL
7
+ extend FFI::Library
8
+
9
+ #------------------------------------------------------------------------
10
+ # Enums
11
+ #------------------------------------------------------------------------
12
+ GDALGridAlgorithm = enum :GCA_InverseDistanceToAPower,
13
+ :GCA_MovingAverage,
14
+ :GCA_NearestNeighbor,
15
+ :GCA_MetricMinimum,
16
+ :GCA_MetricMaximum,
17
+ :GCA_MetricRange,
18
+ :GCA_MetricCount,
19
+ :GCA_MetricAverageDistance,
20
+ :GCA_MetricAverageDistancePts
21
+
22
+ #------------------------------------------------------------------------
23
+ # Typedefs
24
+ #------------------------------------------------------------------------
25
+ callback :GDALTransformerFunc,
26
+ %i[pointer int int pointer pointer pointer pointer],
27
+ :int
28
+
29
+ #------------------------------------------------------------------------
30
+ # Functions
31
+ #------------------------------------------------------------------------
32
+ attach_function :GDALApproxTransform,
33
+ %i[pointer int int pointer pointer pointer pointer],
34
+ :int
35
+ attach_function :GDALChecksumImage,
36
+ %i[GDALRasterBandH int int int int],
37
+ :int
38
+ attach_function :GDALComputeMedianCutPCT,
39
+ %i[GDALRasterBandH GDALRasterBandH GDALRasterBandH pointer
40
+ int GDALColorTableH GDALProgressFunc pointer],
41
+ :int
42
+ attach_function :GDALComputeProximity,
43
+ %i[GDALRasterBandH GDALRasterBandH pointer GDALProgressFunc pointer],
44
+ CPLErr
45
+ attach_function :GDALContourGenerate,
46
+ %i[GDALRasterBandH double double int pointer int double pointer
47
+ int int GDALProgressFunc pointer],
48
+ CPLErr
49
+ attach_function :GDALCreateApproxTransformer,
50
+ %i[GDALTransformerFunc pointer double],
51
+ :pointer
52
+ attach_function :GDALCreateGCPTransformer, %i[int pointer int int], :pointer
53
+ attach_function :GDALCreateGenImgProjTransformer,
54
+ %i[GDALDatasetH string GDALDatasetH string bool double int],
55
+ :pointer
56
+ attach_function :GDALCreateGenImgProjTransformer2,
57
+ %i[GDALDatasetH GDALDatasetH pointer],
58
+ :pointer
59
+ attach_function :GDALCreateReprojectionTransformer,
60
+ %i[string string],
61
+ :pointer
62
+ attach_function :GDALCreateRPCTransformer,
63
+ [GDALRPCInfo.ptr, :int, :double, :pointer],
64
+ :pointer
65
+ attach_function :GDALCreateTPSTransformer, %i[int pointer int], :pointer
66
+
67
+ attach_function :GDALDestroyApproxTransformer, %i[pointer], :void
68
+ attach_function :GDALDestroyGCPTransformer, %i[pointer], :pointer
69
+ attach_function :GDALDestroyGenImgProjTransformer, %i[pointer], :pointer
70
+ attach_function :GDALDestroyReprojectionTransformer, %i[pointer], :pointer
71
+ attach_function :GDALDestroyTPSTransformer, %i[pointer], :pointer
72
+
73
+ attach_function :GDALDitherRGB2PCT,
74
+ %i[GDALRasterBandH GDALRasterBandH GDALRasterBandH GDALRasterBandH
75
+ GDALColorTableH GDALProgressFunc pointer],
76
+ CPLErr
77
+ attach_function :GDALPolygonize,
78
+ %i[GDALRasterBandH GDALRasterBandH OGRLayerH int pointer GDALProgressFunc pointer],
79
+ CPLErr
80
+ attach_function :GDALFPolygonize,
81
+ %i[GDALRasterBandH GDALRasterBandH OGRLayerH int pointer
82
+ GDALProgressFunc pointer],
83
+ CPLErr
84
+ attach_function :GDALGCPTransform,
85
+ %i[pointer int int pointer pointer pointer pointer],
86
+ :bool
87
+ attach_function :GDALGenImgProjTransform,
88
+ %i[pointer int int pointer pointer pointer pointer],
89
+ :bool
90
+
91
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
+ # Dataset-related
93
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94
+ attach_function :GDALGridCreate,
95
+ [GDALGridAlgorithm, :pointer, :GUInt32, :pointer, :pointer, :pointer,
96
+ :double, :double, :double, :double, :GUInt32, :GUInt32, GDALDataType,
97
+ :pointer, :GDALProgressFunc, :pointer],
98
+ CPLErr
99
+ attach_function :GDALRasterizeGeometries,
100
+ %i[GDALDatasetH int pointer int pointer GDALTransformerFunc
101
+ pointer pointer pointer GDALProgressFunc pointer],
102
+ CPLErr
103
+ attach_function :GDALRasterizeLayers,
104
+ %i[GDALDatasetH int pointer int pointer GDALTransformerFunc
105
+ pointer pointer pointer GDALProgressFunc pointer],
106
+ CPLErr
107
+ attach_function :GDALRasterizeLayersBuf,
108
+ [:pointer, :int, :int, GDALDataType, :int, :int, :int, :pointer, :string,
109
+ :pointer, :GDALTransformerFunc, :pointer, :double, :pointer,
110
+ :GDALProgressFunc, :pointer],
111
+ CPLErr
112
+
113
+ attach_function :GDALReprojectionTransform,
114
+ %i[pointer int int pointer pointer pointer pointer],
115
+ :int
116
+ attach_function :GDALSetGenImgProjTransformerDstGeoTransform,
117
+ %i[pointer pointer],
118
+ :void
119
+ attach_function :GDALSimpleImageWarp,
120
+ %i[GDALDatasetH GDALDatasetH int pointer GDALTransformerFunc pointer
121
+ GDALProgressFunc pointer pointer],
122
+ :bool
123
+ attach_function :GDALSuggestedWarpOutput,
124
+ %i[GDALDatasetH GDALTransformerFunc pointer pointer pointer pointer],
125
+ CPLErr
126
+ end
127
+ end
@@ -0,0 +1,14 @@
1
+ require 'ffi'
2
+
3
+
4
+ module FFI
5
+ module GDAL
6
+ class GDALGridDataMetricsOptions < FFI::Struct
7
+ layout :radius1, :double,
8
+ :radius2, :double,
9
+ :angle, :double,
10
+ :min_points, :GUInt32,
11
+ :no_data_value, :double
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ require 'ffi'
2
+
3
+
4
+ module FFI
5
+ module GDAL
6
+ class GDALGridInverseDistanceToAPowerOptions < FFI::Struct
7
+ layout :power, :double,
8
+ :smoothing, :double,
9
+ :anisotropy_ratio, :double,
10
+ :anisotropy_angle, :double,
11
+ :radius1, :double,
12
+ :radius2, :double,
13
+ :angle, :double,
14
+ :max_points, :GUInt32,
15
+ :min_points, :GUInt32,
16
+ :no_data_value, :double
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ require 'ffi'
2
+
3
+
4
+ module FFI
5
+ module GDAL
6
+ class GDALGridMovingAverageOptions < FFI::Struct
7
+ layout :radius1, :double,
8
+ :radius2, :double,
9
+ :angle, :double,
10
+ :min_points, :GUInt32,
11
+ :no_data_value, :double
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'ffi'
2
+
3
+
4
+ module FFI
5
+ module GDAL
6
+ class GDALGridNearestNeighborOptions < FFI::Struct
7
+ layout :radius1, :double,
8
+ :radius2, :double,
9
+ :angle, :double,
10
+ :no_data_value, :double
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,683 @@
1
+ require 'ffi'
2
+
3
+ module FFI
4
+ module GDAL
5
+
6
+ #-----------------------------------------------------------------
7
+ # Enums
8
+ #-----------------------------------------------------------------
9
+ GDALDataType = enum :GDT_Unknown, 0,
10
+ :GDT_Byte, 1,
11
+ :GDT_UInt16, 2,
12
+ :GDT_Int16, 3,
13
+ :GDT_UInt32, 4,
14
+ :GDT_Int32, 5,
15
+ :GDT_Float32, 6,
16
+ :GDT_Float64, 7,
17
+ :GDT_CInt16, 8,
18
+ :GDT_CInt32, 9,
19
+ :GDT_CFloat32, 10,
20
+ :GDT_CFloat64, 11,
21
+ :GDT_TypeCount, 12
22
+
23
+ GDALAsyncStatusType = enum :GARIO_PENDING, 0,
24
+ :GARIO_UPDATE, 1,
25
+ :GARIO_ERROR, 2,
26
+ :GARIO_COMPLETE, 3,
27
+ :GARIO_TypeCount, 4
28
+
29
+ GDALAccess = enum :GA_ReadOnly, 0,
30
+ :GA_Update, 1
31
+
32
+ GDALRWFlag = enum :GF_Read, 0,
33
+ :GF_Write, 1
34
+
35
+ GDALColorInterp = enum :GCI_Undefined, 0,
36
+ :GCI_GrayIndex, 1,
37
+ :GCI_PaletteIndex, 2,
38
+ :GCI_RedBand, 3,
39
+ :GCI_GreenBand, 4,
40
+ :GCI_BlueBand, 5,
41
+ :GCI_AlphaBand, 6,
42
+ :GCI_HueBand, 7,
43
+ :GCI_SaturationBand, 8,
44
+ :GCI_LightnessBand, 9,
45
+ :GCI_CyanBand, 10,
46
+ :GCI_MagentaBand, 11,
47
+ :GCI_YellowBand, 12,
48
+ :GCI_BlackBand, 13,
49
+ :GCI_YCbCr_YBand, 14,
50
+ :GCI_YCbCr_CbBand, 15,
51
+ :GCI_YCbCr_CrBand, 16,
52
+ :GCI_Max, 16 # Seems wrong that this is also 16...
53
+
54
+ GDALPaletteInterp = enum :GPI_Gray, 0,
55
+ :GPI_RGB, 1,
56
+ :GPI_CMYK, 2,
57
+ :GPI_HLS, 3
58
+
59
+ GDALRATFieldType = enum :GFT_Integer,
60
+ :GFT_Real,
61
+ :GFT_String
62
+
63
+ GDALRATFieldUsage = enum :GFU_Generic, 0,
64
+ :GFU_PixelCount, 1,
65
+ :GFU_Name, 2,
66
+ :GFU_Min, 3,
67
+ :GFU_Max, 4,
68
+ :GFU_MinMax, 5,
69
+ :GFU_Red, 6,
70
+ :GFU_Green, 7,
71
+ :GFU_Blue, 8,
72
+ :GFU_Alpha, 9,
73
+ :GFU_RedMin, 10,
74
+ :GFU_GreenMin, 11,
75
+ :GFU_BlueMin, 12,
76
+ :GFU_AlphaMin, 13,
77
+ :GFU_RedMax, 14,
78
+ :GFU_GreenMax, 15,
79
+ :GFU_BlueMax, 16,
80
+ :GFU_AlphaMax, 17,
81
+ :GFU_MaxCount
82
+
83
+ GDALTileOrganization = enum :GTO_TIP,
84
+ :GTO_BIT,
85
+ :GTO_BSQ
86
+
87
+ #-----------------------------------------------------------------
88
+ # typedefs
89
+ #-----------------------------------------------------------------
90
+ typedef :pointer, :GDALMajorObjectH
91
+ typedef :pointer, :GDALDatasetH
92
+ typedef :pointer, :GDALRasterBandH
93
+ typedef :pointer, :GDALDriverH
94
+ typedef :pointer, :GDALColorTableH
95
+ typedef :pointer, :GDALRasterAttributeTableH
96
+ typedef :pointer, :GDALAsyncReaderH
97
+
98
+ # When using, make sure to return +true+ if the operation should continue;
99
+ # +false+ if the user has cancelled.
100
+ callback :GDALProgressFunc,
101
+ [:double, :string, :pointer], # completion, message, progress_arg
102
+ :bool
103
+
104
+ callback :GDALDerivedPixelFunc,
105
+ [:pointer, :int, :pointer, :int, :int, GDALDataType, GDALDataType, :int, :int],
106
+ :int
107
+ end
108
+
109
+ end
110
+
111
+ # These requires depend on ^^^
112
+ require_relative 'alg_h'
113
+ require_relative 'grid_h'
114
+ require_relative 'warper_h'
115
+
116
+ module FFI
117
+ module GDAL
118
+
119
+ #-----------------------------------------------------------------
120
+ # functions
121
+ #-----------------------------------------------------------------
122
+ # AsyncStatus
123
+ attach_function :GDALGetAsyncStatusTypeName, [GDALAsyncStatusType], :string
124
+ attach_function :GDALGetAsyncStatusTypeByName, [:string], GDALAsyncStatusType
125
+
126
+ #~~~~~~~~~~~~~~~~~~~~
127
+ # ColorInterpretation
128
+ #~~~~~~~~~~~~~~~~~~~~
129
+ attach_function :GDALGetColorInterpretationName, [GDALColorInterp], :string
130
+ attach_function :GDALGetColorInterpretationByName, [:string], GDALColorInterp
131
+
132
+ #~~~~~~~~~~~~~~~~~~~~
133
+ # Driver
134
+ #~~~~~~~~~~~~~~~~~~~~
135
+ attach_function :GDALAllRegister, [], :void
136
+
137
+ # Class-level functions
138
+ attach_function :GDALGetDriver, [:int], :GDALDriverH
139
+ attach_function :GDALGetDriverCount, [], :int
140
+ attach_function :GDALIdentifyDriver, %i[string pointer], :GDALDriverH
141
+ attach_function :GDALGetDriverByName, [:string], :GDALDriverH
142
+ attach_function :GDALDestroyDriverManager, [:void], :void
143
+
144
+ # Instance-level functions
145
+ attach_function :GDALCreate,
146
+ [:GDALDriverH, :string, :int, :int, :int, GDALDataType, :pointer],
147
+ :GDALDatasetH
148
+ attach_function :GDALCreateCopy,
149
+ %i[GDALDriverH string GDALDatasetH bool pointer GDALProgressFunc pointer],
150
+ :GDALDatasetH
151
+ attach_function :GDALValidateCreationOptions, %i[GDALDriverH pointer], CPLErr
152
+ attach_function :GDALGetDriverShortName, [:GDALDriverH], :string
153
+ attach_function :GDALGetDriverLongName, [:GDALDriverH], :string
154
+ attach_function :GDALGetDriverHelpTopic, [:GDALDriverH], :string
155
+ attach_function :GDALGetDriverCreationOptionList, [:GDALDriverH], :string
156
+
157
+ attach_function :GDALDestroyDriver, [:GDALDriverH], :void
158
+ attach_function :GDALRegisterDriver, [:GDALDriverH], :int
159
+ attach_function :GDALDeregisterDriver, [:GDALDriverH], :void
160
+ attach_function :GDALDeleteDataset, [:GDALDriverH, :string], CPLErr
161
+ attach_function :GDALRenameDataset,
162
+ %i[GDALDriverH string string],
163
+ CPLErr
164
+ attach_function :GDALCopyDatasetFiles,
165
+ %i[GDALDriverH string string],
166
+ CPLErr
167
+
168
+ #~~~~~~~~~~~~~~~~~~~~
169
+ # Dataset
170
+ #~~~~~~~~~~~~~~~~~~~~
171
+ # Class-level functions
172
+ attach_function :GDALOpen, [:string, GDALAccess], :GDALDatasetH
173
+ attach_function :GDALOpenShared,
174
+ [:string, GDALAccess],
175
+ :GDALDatasetH
176
+ attach_function :GDALOpenEx,
177
+ %i[string uint string string string],
178
+ :GDALDatasetH
179
+ attach_function :GDALDumpOpenDatasets, [:pointer], :int
180
+ attach_function :GDALGetOpenDatasets, [:pointer, :pointer], :void
181
+
182
+ # Instance-level functions
183
+ attach_function :GDALClose, [:GDALDatasetH], :void
184
+ attach_function :GDALGetDatasetDriver, [:GDALDatasetH], :GDALDriverH
185
+ attach_function :GDALGetFileList, [:GDALDatasetH], :pointer
186
+ attach_function :GDALGetInternalHandle, [:GDALDatasetH, :string], :pointer
187
+ attach_function :GDALReferenceDataset, [:GDALDatasetH], :int
188
+ attach_function :GDALDereferenceDataset, [:GDALDatasetH], :int
189
+
190
+ attach_function :GDALGetAccess, [:GDALDatasetH], :int
191
+ attach_function :GDALFlushCache, [:GDALDatasetH], :void
192
+
193
+ attach_function :GDALGetRasterXSize, [:GDALDatasetH], :int
194
+ attach_function :GDALGetRasterYSize, [:GDALDatasetH], :int
195
+ attach_function :GDALGetRasterCount, [:GDALDatasetH], :int
196
+ attach_function :GDALGetRasterBand, [:GDALDatasetH, :int], :GDALRasterBandH
197
+ attach_function :GDALAddBand,
198
+ [:GDALDatasetH, GDALDataType, :pointer],
199
+ CPLErr
200
+ attach_function :GDALBeginAsyncReader,
201
+ [
202
+ :GDALDatasetH,
203
+ GDALRWFlag,
204
+ :int,
205
+ :int,
206
+ :int,
207
+ :int,
208
+ :pointer,
209
+ :int,
210
+ :int,
211
+ GDALDataType,
212
+ :int,
213
+ :pointer,
214
+ :int,
215
+ :int,
216
+ :int
217
+ ], :GDALAsyncReaderH
218
+
219
+ attach_function :GDALEndAsyncReader,
220
+ [:GDALDatasetH, :GDALAsyncReaderH],
221
+ :void
222
+
223
+ attach_function :GDALDatasetRasterIO,
224
+ [
225
+ :GDALDatasetH,
226
+ GDALRWFlag,
227
+ :int,
228
+ :int,
229
+ :int,
230
+ :int,
231
+ :pointer,
232
+ :int,
233
+ :int,
234
+ GDALDataType,
235
+ :int,
236
+ :pointer,
237
+ :int,
238
+ :int,
239
+ :int
240
+ ], CPLErr
241
+
242
+ attach_function :GDALDatasetAdviseRead,
243
+ [
244
+ :GDALDatasetH,
245
+ :int,
246
+ :int,
247
+ :int,
248
+ :int,
249
+ :int,
250
+ :int,
251
+ GDALDataType,
252
+ :int,
253
+ :pointer,
254
+ :pointer
255
+ ], CPLErr
256
+
257
+ attach_function :GDALInitGCPs, [:int, :pointer], :void
258
+ attach_function :GDALDeinitGCPs, [:int, :pointer], :void
259
+ attach_function :GDALDuplicateGCPs, [:int, :pointer], :pointer
260
+ attach_function :GDALGCPsToGeoTransform,
261
+ [:int, :pointer, :pointer, :int],
262
+ :int
263
+ attach_function :GDALGetGCPCount, [:GDALDatasetH], :int
264
+ attach_function :GDALGetGCPProjection, [:GDALDatasetH], :string
265
+ attach_function :GDALGetGCPs, [:GDALDatasetH], :pointer
266
+ attach_function :GDALSetGCPs,
267
+ [:GDALDatasetH, :int, :pointer, :string],
268
+ CPLErr
269
+
270
+ attach_function :GDALGetProjectionRef, [:GDALDatasetH], :string
271
+ attach_function :GDALSetProjection, [:GDALDatasetH, :string], CPLErr
272
+ attach_function :GDALGetGeoTransform, [:GDALDatasetH, :pointer], CPLErr
273
+ attach_function :GDALSetGeoTransform,
274
+ [:GDALDatasetH, :pointer],
275
+ CPLErr
276
+
277
+ attach_function :GDALBuildOverviews,
278
+ [
279
+ :GDALDatasetH,
280
+ :string,
281
+ :int,
282
+ :pointer,
283
+ :int,
284
+ :pointer,
285
+ :GDALProgressFunc,
286
+ :pointer
287
+ ], CPLErr
288
+
289
+ # OGR datasets. Not found in v1.11.1
290
+ attach_function :GDALDatasetGetLayerCount, [:GDALDatasetH], :int
291
+ attach_function :GDALDatasetGetLayer, [:GDALDatasetH, :int], :OGRLayerH
292
+ attach_function :GDALDatasetGetLayerByName, [:GDALDatasetH, :string], :OGRLayerH
293
+ attach_function :GDALDatasetDeleteLayer, [:GDALDatasetH, :int], OGRErr
294
+ attach_function :GDALDatasetCreateLayer,
295
+ [:GDALDatasetH, :string, :OGRSpatialReferenceH, OGRwkbGeometryType, :pointer],
296
+ :OGRLayerH
297
+ attach_function :GDALDatasetCopyLayer,
298
+ %i[GDALDatasetH OGRLayerH string pointer],
299
+ :OGRLayerH
300
+ attach_function :GDALDatasetTestCapability, [:GDALDatasetH, :string], :int
301
+ attach_function :GDALDatasetExecuteSQL,
302
+ [:GDALDatasetH, :string, :OGRGeometryH, :string],
303
+ :OGRLayerH
304
+ attach_function :GDALDatasetReleaseResultSet,
305
+ %i[GDALDatasetH OGRLayerH],
306
+ :void
307
+ attach_function :GDALDatasetGetStyleTable, [:GDALDatasetH], :OGRStyleTableH
308
+ attach_function :GDALDatasetSetStyleTableDirectly,
309
+ %i[GDALDatasetH OGRStyleTableH],
310
+ :void
311
+ attach_function :GDALDatasetSetStyleTable,
312
+ %i[GDALDatasetH OGRStyleTableH],
313
+ :void
314
+
315
+ attach_function :GDALCreateDatasetMaskBand, [:GDALDatasetH, :int], CPLErr
316
+ attach_function :GDALDatasetCopyWholeRaster,
317
+ %i[GDALDatasetH GDALDatasetH pointer GDALProgressFunc pointer],
318
+ CPLErr
319
+
320
+ #~~~~~~~~~~~~~~~~~~~~
321
+ # MajorObject
322
+ #~~~~~~~~~~~~~~~~~~~~
323
+ attach_function :GDALGetMetadataDomainList, [:GDALMajorObjectH], :pointer
324
+ attach_function :GDALGetMetadata, %i[GDALMajorObjectH string], :pointer
325
+ attach_function :GDALSetMetadata, %i[GDALMajorObjectH pointer string], CPLErr
326
+ attach_function :GDALGetMetadataItem,
327
+ %i[GDALMajorObjectH string string],
328
+ :string
329
+ attach_function :GDALSetMetadataItem,
330
+ %i[GDALMajorObjectH string string string],
331
+ CPLErr
332
+ attach_function :GDALGetDescription, [:GDALMajorObjectH], :string
333
+ attach_function :GDALSetDescription, %i[GDALMajorObjectH string], :void
334
+
335
+ #~~~~~~~~~~~~~~~~~~~~
336
+ # GeoTransform
337
+ #~~~~~~~~~~~~~~~~~~~~
338
+ attach_function :GDALInvGeoTransform, %i[pointer pointer], :int
339
+ attach_function :GDALApplyGeoTransform,
340
+ %i[pointer double double pointer pointer],
341
+ :void
342
+ attach_function :GDALComposeGeoTransforms,
343
+ %i[pointer pointer pointer],
344
+ :void
345
+
346
+ #-----------------
347
+ # Raster functions
348
+ #-----------------
349
+ attach_function :GDALRasterBandCopyWholeRaster,
350
+ [
351
+ :GDALRasterBandH,
352
+ :GDALRasterBandH,
353
+ :pointer,
354
+ :GDALProgressFunc,
355
+ :pointer
356
+ ], CPLErr
357
+ attach_function :GDALRegenerateOverviews,
358
+ [
359
+ :GDALRasterBandH,
360
+ :int,
361
+ :pointer,
362
+ :string,
363
+ :GDALProgressFunc,
364
+ :pointer
365
+ ], CPLErr
366
+ attach_function :GDALGetMaskBand, [:GDALRasterBandH], :GDALRasterBandH
367
+ attach_function :GDALGetMaskFlags, [:GDALRasterBandH], :int
368
+ attach_function :GDALCreateMaskBand,
369
+ [:GDALRasterBandH, :int],
370
+ CPLErr
371
+
372
+ attach_function :GDALGetRasterDataType, [:GDALRasterBandH], GDALDataType
373
+ attach_function :GDALGetBlockSize,
374
+ [:GDALRasterBandH, :pointer, :pointer],
375
+ GDALDataType
376
+
377
+ attach_function :GDALRasterAdviseRead,
378
+ [
379
+ :GDALRasterBandH,
380
+ :int,
381
+ :int,
382
+ :int,
383
+ :int,
384
+ :int,
385
+ :int,
386
+ GDALDataType,
387
+ :pointer
388
+ ], CPLErr
389
+
390
+ attach_function :GDALRasterIO,
391
+ [
392
+ :GDALRasterBandH,
393
+ GDALRWFlag,
394
+ :int,
395
+ :int,
396
+ :int,
397
+ :int,
398
+ :pointer,
399
+ :int,
400
+ :int,
401
+ GDALDataType,
402
+ :int,
403
+ :int
404
+ ], CPLErr
405
+ attach_function :GDALReadBlock,
406
+ [:GDALRasterBandH, :int, :int, :pointer],
407
+ CPLErr
408
+ attach_function :GDALWriteBlock,
409
+ [:GDALRasterBandH, :int, :int, :pointer],
410
+ CPLErr
411
+ attach_function :GDALGetRasterBandXSize, [:GDALRasterBandH], :int
412
+ attach_function :GDALGetRasterBandYSize, [:GDALRasterBandH], :int
413
+ attach_function :GDALGetRasterAccess, [:GDALRasterBandH], GDALAccess
414
+ attach_function :GDALGetBandNumber, [:GDALRasterBandH], :int
415
+ attach_function :GDALGetBandDataset, [:GDALRasterBandH], :GDALDatasetH
416
+ attach_function :GDALGetRasterColorInterpretation,
417
+ [:GDALRasterBandH],
418
+ GDALColorInterp
419
+ attach_function :GDALSetRasterColorInterpretation,
420
+ [:GDALRasterBandH, GDALColorInterp],
421
+ CPLErr
422
+ attach_function :GDALGetRasterColorTable,
423
+ [:GDALRasterBandH],
424
+ :GDALColorTableH
425
+ attach_function :GDALSetRasterColorTable,
426
+ [:GDALRasterBandH, :GDALColorTableH],
427
+ CPLErr
428
+
429
+ attach_function :GDALHasArbitraryOverviews, [:GDALRasterBandH], :int
430
+ attach_function :GDALGetOverviewCount, [:GDALRasterBandH], :int
431
+ attach_function :GDALGetOverview, [:GDALRasterBandH, :int], :GDALRasterBandH
432
+ attach_function :GDALGetRasterNoDataValue,
433
+ [:GDALRasterBandH, :pointer],
434
+ :double
435
+ attach_function :GDALSetRasterNoDataValue,
436
+ [:GDALRasterBandH, :double],
437
+ CPLErr
438
+ attach_function :GDALGetRasterCategoryNames,
439
+ [:GDALRasterBandH],
440
+ :pointer
441
+ attach_function :GDALSetRasterCategoryNames,
442
+ [:GDALRasterBandH, :pointer],
443
+ CPLErr
444
+ attach_function :GDALGetRasterMinimum,
445
+ [:GDALRasterBandH, :pointer],
446
+ :double
447
+ attach_function :GDALGetRasterMaximum,
448
+ [:GDALRasterBandH, :pointer],
449
+ :double
450
+ attach_function :GDALGetRasterStatistics,
451
+ [:GDALRasterBandH, :bool, :bool, :pointer, :pointer, :pointer, :pointer],
452
+ CPLErr
453
+ attach_function :GDALComputeRasterStatistics,
454
+ [
455
+ :GDALRasterBandH,
456
+ :bool,
457
+ :pointer,
458
+ :pointer,
459
+ :pointer,
460
+ :pointer,
461
+ :GDALProgressFunc,
462
+ :pointer
463
+ ], CPLErr
464
+ attach_function :GDALSetRasterStatistics,
465
+ [:GDALRasterBandH, :double, :double, :double, :double],
466
+ CPLErr
467
+ attach_function :GDALGetRasterUnitType, [:GDALRasterBandH], :string
468
+ attach_function :GDALSetRasterUnitType, [:GDALRasterBandH, :string], CPLErr
469
+ attach_function :GDALGetRasterOffset, [:GDALRasterBandH, :pointer], :double
470
+ attach_function :GDALSetRasterOffset, [:GDALRasterBandH, :double], CPLErr
471
+ attach_function :GDALGetRasterScale, [:GDALRasterBandH, :pointer], :double
472
+ attach_function :GDALSetRasterScale, [:GDALRasterBandH, :double], CPLErr
473
+ attach_function :GDALComputeRasterMinMax,
474
+ [:GDALRasterBandH, :int, :pointer],
475
+ :void
476
+ attach_function :GDALFlushRasterCache, [:GDALRasterBandH], CPLErr
477
+ attach_function :GDALGetRasterHistogram,
478
+ [
479
+ :GDALRasterBandH,
480
+ :double,
481
+ :double,
482
+ :int,
483
+ :pointer,
484
+ :bool,
485
+ :bool,
486
+ :GDALProgressFunc,
487
+ :pointer
488
+ ], CPLErr
489
+
490
+ attach_function :GDALGetDefaultHistogram,
491
+ [
492
+ :GDALRasterBandH,
493
+ :pointer,
494
+ :pointer,
495
+ :pointer,
496
+ :pointer,
497
+ :bool,
498
+ :GDALProgressFunc,
499
+ :pointer
500
+ ], CPLErr
501
+ attach_function :GDALSetDefaultHistogram,
502
+ [
503
+ :GDALRasterBandH,
504
+ :double,
505
+ :double,
506
+ :int,
507
+ :pointer
508
+ ], CPLErr
509
+
510
+ attach_function :GDALGetRandomRasterSample,
511
+ [:GDALRasterBandH, :int, :pointer],
512
+ :int
513
+ attach_function :GDALGetRasterSampleOverview,
514
+ [:GDALRasterBandH, :int],
515
+ :GDALRasterBandH
516
+ attach_function :GDALFillRaster,
517
+ [:GDALRasterBandH, :double, :double],
518
+ CPLErr
519
+
520
+ attach_function :GDALGetDefaultRAT,
521
+ [:GDALRasterBandH],
522
+ :GDALRasterAttributeTableH
523
+ attach_function :GDALSetDefaultRAT,
524
+ [:GDALRasterBandH, :GDALRasterAttributeTableH],
525
+ CPLErr
526
+ attach_function :GDALAddDerivedBandPixelFunc,
527
+ [:string, :GDALDerivedPixelFunc],
528
+ CPLErr
529
+
530
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
531
+ # Raster Attribute Table functions
532
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
533
+ # Class-level functions
534
+ attach_function :GDALCreateRasterAttributeTable,
535
+ [],
536
+ :GDALRasterAttributeTableH
537
+
538
+ # Instance-level functions
539
+ attach_function :GDALDestroyRasterAttributeTable,
540
+ [:GDALRasterAttributeTableH],
541
+ :void
542
+ attach_function :GDALRATChangesAreWrittenToFile,
543
+ [:GDALRasterAttributeTableH],
544
+ :bool
545
+ attach_function :GDALRATClone,
546
+ [:GDALRasterAttributeTableH],
547
+ :GDALRasterAttributeTableH
548
+
549
+ attach_function :GDALRATGetColumnCount,
550
+ [:GDALRasterAttributeTableH],
551
+ :int
552
+ attach_function :GDALRATGetNameOfCol,
553
+ [:GDALRasterAttributeTableH, :int],
554
+ :string
555
+ attach_function :GDALRATGetUsageOfCol,
556
+ [:GDALRasterAttributeTableH, :int],
557
+ GDALRATFieldUsage
558
+ attach_function :GDALRATGetTypeOfCol,
559
+ [:GDALRasterAttributeTableH, :int],
560
+ GDALRATFieldType
561
+ attach_function :GDALRATGetColOfUsage,
562
+ [:GDALRasterAttributeTableH, GDALRATFieldUsage],
563
+ :int
564
+ attach_function :GDALRATCreateColumn,
565
+ [:GDALRasterAttributeTableH, :string, GDALRATFieldType, GDALRATFieldUsage],
566
+ CPLErr
567
+
568
+ attach_function :GDALRATGetValueAsString,
569
+ %i[GDALRasterAttributeTableH int int],
570
+ :string
571
+ attach_function :GDALRATGetValueAsInt,
572
+ %i[GDALRasterAttributeTableH int int],
573
+ :int
574
+ attach_function :GDALRATGetValueAsDouble,
575
+ %i[GDALRasterAttributeTableH int int],
576
+ :double
577
+ attach_function :GDALRATSetValueAsString,
578
+ %i[GDALRasterAttributeTableH int int string],
579
+ :void
580
+ attach_function :GDALRATSetValueAsInt,
581
+ %i[GDALRasterAttributeTableH int int int],
582
+ :void
583
+ attach_function :GDALRATSetValueAsDouble,
584
+ %i[GDALRasterAttributeTableH int int double],
585
+ :void
586
+ attach_function :GDALRATValuesIOAsDouble,
587
+ [:GDALRasterAttributeTableH, GDALRWFlag, :int, :int, :int, :pointer],
588
+ CPLErr
589
+ attach_function :GDALRATValuesIOAsInteger,
590
+ [:GDALRasterAttributeTableH, GDALRWFlag, :int, :int, :int, :pointer],
591
+ CPLErr
592
+ attach_function :GDALRATValuesIOAsString,
593
+ [:GDALRasterAttributeTableH, GDALRWFlag, :int, :int, :int, :pointer],
594
+ CPLErr
595
+
596
+ attach_function :GDALRATGetRowCount,
597
+ [:GDALRasterAttributeTableH],
598
+ :int
599
+ attach_function :GDALRATSetRowCount,
600
+ %i[GDALRasterAttributeTableH int],
601
+ :void
602
+ attach_function :GDALRATGetRowOfValue,
603
+ %i[GDALRasterAttributeTableH double],
604
+ :int
605
+
606
+ attach_function :GDALRATSetLinearBinning,
607
+ %i[GDALRasterAttributeTableH double double],
608
+ :int
609
+ attach_function :GDALRATGetLinearBinning,
610
+ %i[GDALRasterAttributeTableH pointer pointer],
611
+ :int
612
+ attach_function :GDALRATTranslateToColorTable,
613
+ %i[GDALRasterAttributeTableH int],
614
+ :GDALColorTableH
615
+ attach_function :GDALRATInitializeFromColorTable,
616
+ %i[GDALRasterAttributeTableH GDALColorTableH],
617
+ CPLErr
618
+
619
+ attach_function :GDALRATDumpReadable,
620
+ %i[GDALRasterAttributeTableH pointer],
621
+ :void
622
+
623
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
624
+ # ColorTable functions
625
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
626
+ # Class-level functions
627
+ attach_function :GDALCreateColorTable, [GDALPaletteInterp], :GDALColorTableH
628
+
629
+ # Instance-level functions
630
+ attach_function :GDALDestroyColorTable, [:GDALColorTableH], :void
631
+ attach_function :GDALCloneColorTable, [:GDALColorTableH], :GDALColorTableH
632
+
633
+ attach_function :GDALGetPaletteInterpretation, [:GDALColorTableH], GDALPaletteInterp
634
+ attach_function :GDALGetColorEntryCount, [:GDALColorTableH], :int
635
+ attach_function :GDALGetColorEntry, [:GDALColorTableH, :int], GDALColorEntry.ptr
636
+ attach_function :GDALGetColorEntryAsRGB, [:GDALColorTableH, :int, GDALColorEntry], :int
637
+ attach_function :GDALSetColorEntry, [:GDALColorTableH, :int, GDALColorEntry.ptr], :void
638
+
639
+ attach_function :GDALCreateColorRamp,
640
+ [:GDALColorTableH, :int, GDALColorEntry.ptr, :int, GDALColorEntry.ptr],
641
+ :void
642
+
643
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644
+ # PaletteInterp functions
645
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
646
+ attach_function :GDALGetPaletteInterpretationName, [GDALPaletteInterp], :string
647
+
648
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
649
+ # General stuff
650
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
651
+ attach_function :GDALGetDataTypeSize, [GDALDataType], :int
652
+ attach_function :GDALDataTypeIsComplex, [GDALDataType], :bool
653
+ attach_function :GDALGetDataTypeName, [GDALDataType], :string
654
+ attach_function :GDALGetDataTypeByName, [:string], GDALDataType
655
+ attach_function :GDALDataTypeUnion, [GDALDataType, GDALDataType], GDALDataType
656
+
657
+ attach_function :GDALSetCacheMax, %i[int], :void
658
+ attach_function :GDALSetCacheMax64, %i[GIntBig], :void
659
+ attach_function :GDALGetCacheMax, [], :int
660
+ attach_function :GDALGetCacheMax64, [], :GIntBig
661
+ attach_function :GDALGetCacheUsed, [], :int
662
+ attach_function :GDALGetCacheUsed64, [], :GIntBig
663
+ attach_function :GDALFlushCacheBlock, [], :bool
664
+
665
+ attach_function :GDALLoadWorldFile, %i[string pointer], :bool
666
+ attach_function :GDALReadWorldFile, %i[string string pointer], :bool
667
+ attach_function :GDALWriteWorldFile, %i[string string pointer], :bool
668
+
669
+ attach_function :GDALPackedDMSToDec, %i[double], :double
670
+ attach_function :GDALDecToPackedDMS, %i[double], :double
671
+
672
+ attach_function :GDALGeneralCmdLineProcessor, %i[int pointer int], :int
673
+ attach_function :GDALSwapWords,
674
+ %i[pointer int int int],
675
+ :void
676
+ attach_function :GDALCopyWords,
677
+ %i[pointer int int pointer int int int int],
678
+ :void
679
+ attach_function :GDALCopyBits,
680
+ %i[pointer int int pointer int int int int],
681
+ :void
682
+ end
683
+ end