ffi-gdal 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/History.md +5 -0
- data/lib/ffi-gdal/major_object.rb +5 -0
- data/lib/ffi-gdal/raster_band.rb +5 -1
- data/lib/ffi/gdal.rb +74 -47
- data/lib/ffi/gdal/cpl_conv.rb +124 -131
- data/lib/ffi/gdal/cpl_error.rb +71 -75
- data/lib/ffi/gdal/cpl_string.rb +101 -108
- data/lib/ffi/gdal/cpl_vsi.rb +95 -102
- data/lib/ffi/gdal/ogr_api.rb +16 -23
- data/lib/ffi/gdal/ogr_core.rb +191 -195
- data/lib/ffi/gdal/ogr_srs_api.rb +37 -41
- data/lib/ffi/gdal/version.rb +1 -1
- data/spec/ffi-gdal/integration/raster_band_info_spec.rb +2 -0
- metadata +2 -2
data/lib/ffi/gdal/ogr_api.rb
CHANGED
@@ -1,28 +1,21 @@
|
|
1
|
-
require 'ffi'
|
2
|
-
|
3
|
-
|
4
1
|
module FFI
|
5
2
|
module GDAL
|
6
|
-
module OGRAPI
|
7
|
-
extend FFI::Library
|
8
|
-
ffi_lib 'gdal'
|
9
3
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
4
|
+
#------------------------------------------------------------------------
|
5
|
+
# Typedefs
|
6
|
+
#------------------------------------------------------------------------
|
7
|
+
typedef :pointer, :OGRGeometryH
|
8
|
+
typedef :pointer, :OGRSpatialReferenceH
|
9
|
+
typedef :pointer, :OGRCoordinateTransformationH
|
10
|
+
typedef :pointer, :OGRFieldDefnH
|
11
|
+
typedef :pointer, :OGRFeatureDefnH
|
12
|
+
typedef :pointer, :OGRFeatureH
|
13
|
+
typedef :pointer, :OGRStyleTableH
|
14
|
+
typedef :pointer, :OGRGeomFieldDefnH
|
15
|
+
typedef :pointer, :OGRLayerH
|
16
|
+
typedef :pointer, :OGRDataSourceH
|
17
|
+
typedef :pointer, :OGRSFDriverH
|
18
|
+
typedef :pointer, :OGRStyleMgrH
|
19
|
+
typedef :pointer, :OGRStyleToolH
|
27
20
|
end
|
28
21
|
end
|
data/lib/ffi/gdal/ogr_core.rb
CHANGED
@@ -1,199 +1,195 @@
|
|
1
1
|
module FFI
|
2
2
|
module GDAL
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
ALTER_TYPE_FLAG
|
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
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
attach_function :OGRParseDate, [:string, :pointer, :int], :int
|
195
|
-
attach_function :GDALVersionInfo, [:string], :string
|
196
|
-
attach_function :GDALCheckVersion, [:int, :int, :string], :int
|
197
|
-
end
|
3
|
+
|
4
|
+
#------------------------------------------------------------------------
|
5
|
+
# Defines
|
6
|
+
#------------------------------------------------------------------------
|
7
|
+
OGRERR_NONE = 0
|
8
|
+
OGRERR_NOT_ENOUGH_DATA = 1
|
9
|
+
OGRERR_NOT_ENOUGH_MEMORY = 2
|
10
|
+
OGRERR_UNSUPPORTED_GEOMETRY_TYPE = 3
|
11
|
+
OGRERR_UNSUPPORTED_OPERATION = 4
|
12
|
+
OGRERR_CORRUPT_DATA = 5
|
13
|
+
OGRERR_FAILURE = 6
|
14
|
+
OGRERR_UNSUPPORTED_SRS = 7
|
15
|
+
OGRERR_INVALID_HANDLE = 8
|
16
|
+
|
17
|
+
WKB_25D_BIT = 0x80000000
|
18
|
+
#WKB_FLATTEN
|
19
|
+
OGR_Z_MARKER = 0x21125711
|
20
|
+
|
21
|
+
ALTER_NAME_FLAG = 0x1
|
22
|
+
ALTER_TYPE_FLAG = 0x2
|
23
|
+
ALTER_WIDTH_PRECISION_FLAG = 0x4
|
24
|
+
ALTER_ALL_FLAG =
|
25
|
+
ALTER_NAME_FLAG | ALTER_TYPE_FLAG | ALTER_WIDTH_PRECISION_FLAG
|
26
|
+
|
27
|
+
OGRNullFID = -1
|
28
|
+
OGRUnsetMarker = -21121
|
29
|
+
OLCRandomRead = 'RandomRead'
|
30
|
+
OLCSequentialWrite = 'SequentialWrite'
|
31
|
+
OLCRandomeWrite = 'RandomWrite'
|
32
|
+
OLCFastSpatialFilter = 'FastSpatialFilter'
|
33
|
+
OLCFastFeatureCount = 'FastFeatureCount'
|
34
|
+
OLCFastGetExtent = 'FastGetExtent'
|
35
|
+
OLCCreateField = 'CreateField'
|
36
|
+
OLCDeleteField = 'DeleteField'
|
37
|
+
OLCReorderFields = 'ReorderFields'
|
38
|
+
OLCAlterFieldDefn = 'AlterFieldDefn'
|
39
|
+
OLCTransactions = 'Transactions'
|
40
|
+
OLCDeleteFeature = 'DeleteFeature'
|
41
|
+
OLCFastSetNextByIndex = 'FastSetNextByIndex'
|
42
|
+
OLCStringsAsUTF8 = 'StringsAsUTF8'
|
43
|
+
OLCIgnoreFields = 'IgnoreFields'
|
44
|
+
OLCCreateGeomField = 'CreateGeomField'
|
45
|
+
|
46
|
+
ODsCCreateLayer = 'CreateLayer'
|
47
|
+
ODsCDeleteLayer = 'DeleteLayer'
|
48
|
+
ODsCCreateGeomFieldAfterCreateLayer = 'CreateGeomFieldAfterCreateLayer'
|
49
|
+
|
50
|
+
ODrCCreateDataSource = 'CreateDataSource'
|
51
|
+
ODrCDeleteDataSource = 'DeleteDataSource'
|
52
|
+
|
53
|
+
#------------------------------------------------------------------------
|
54
|
+
# Enums
|
55
|
+
#------------------------------------------------------------------------
|
56
|
+
OGRwkbGeometryType = enum :wkb_unknown, 0,
|
57
|
+
:wkb_point, 1,
|
58
|
+
:wkb_line_string, 2,
|
59
|
+
:wkb_polygon, 3,
|
60
|
+
:wkb_multi_point, 4,
|
61
|
+
:wkb_multi_line_string, 5,
|
62
|
+
:wkb_mulit_polygon, 6,
|
63
|
+
:wkb_geometry_collection, 7,
|
64
|
+
:wkb_none, 100,
|
65
|
+
:wkb_linear_ring, 101,
|
66
|
+
:wkb_point_25d, 0x80000001,
|
67
|
+
:wkb_line_string_25d, 0x80000002,
|
68
|
+
:wkb_polygon_25d, 0x80000003,
|
69
|
+
:wkb_multi_point_25d, 0x80000004,
|
70
|
+
:wkb_multi_line_string_25d, 0x80000005,
|
71
|
+
:wkb_multi_polygon_25d, 0x80000006,
|
72
|
+
:wkb_geometry_collection_25d, 0x80000007
|
73
|
+
|
74
|
+
OGRwkbVariant = enum :wkb_variant_ogc, :wkb_variant_iso
|
75
|
+
OGRwkbByteOrder = enum :wkb_xdr, 0,
|
76
|
+
:wkb_ndr, 1
|
77
|
+
|
78
|
+
OGRFieldType = enum :oft_integer, 0,
|
79
|
+
:oft_integer_list, 1,
|
80
|
+
:oft_real, 2,
|
81
|
+
:oft_real_list, 3,
|
82
|
+
:oft_string, 4,
|
83
|
+
:oft_string_list, 5,
|
84
|
+
:oft_wide_string, 6,
|
85
|
+
:oft_wide_string_list, 7,
|
86
|
+
:oft_binary, 8,
|
87
|
+
:oft_date, 9,
|
88
|
+
:oft_time, 10,
|
89
|
+
:oft_date_time, 11,
|
90
|
+
:oft_max_type, 11
|
91
|
+
|
92
|
+
OGRJustification = enum :oj_undefined, 0,
|
93
|
+
:oj_left, 1,
|
94
|
+
:oj_right, 2
|
95
|
+
|
96
|
+
OGRStyleToolClassID = enum :ogr_stc_none, 0,
|
97
|
+
:ogr_stc_pen, 1,
|
98
|
+
:ogr_stc_brush, 2,
|
99
|
+
:ogr_stc_symbol, 3,
|
100
|
+
:ogr_stc_label, 4,
|
101
|
+
:ogr_stc_vector, 5
|
102
|
+
|
103
|
+
OGRStyleToolUnitsID = enum :ogr_stu_ground, 0,
|
104
|
+
:ogr_stu_pixel, 1,
|
105
|
+
:ogr_stu_points, 2,
|
106
|
+
:ogr_stu_mm, 3,
|
107
|
+
:ogr_stu_cm, 4,
|
108
|
+
:ogr_stu_inches, 5
|
109
|
+
|
110
|
+
OGRStyleToolParamPenID = enum :ogr_st_pen_color, 0,
|
111
|
+
:ogr_st_pen_width, 1,
|
112
|
+
:ogr_st_pen_pattern, 2,
|
113
|
+
:ogr_st_pen_id, 3,
|
114
|
+
:ogr_st_pen_per_offset, 4,
|
115
|
+
:ogr_st_pen_per_cap, 5,
|
116
|
+
:ogr_st_pen_per_join, 6,
|
117
|
+
:ogr_st_pen_per_priority, 7,
|
118
|
+
:ogr_st_pen_last, 8
|
119
|
+
|
120
|
+
OGRStyleToolParamBrushID = enum :ogr_st_brush_f_color, 0,
|
121
|
+
:ogr_st_brush_b_color, 1,
|
122
|
+
:ogr_st_brush_id, 2,
|
123
|
+
:ogr_st_brush_angle, 3,
|
124
|
+
:ogr_st_brush_size, 4,
|
125
|
+
:ogr_st_brush_dx, 5,
|
126
|
+
:ogr_st_brush_dry, 6,
|
127
|
+
:ogr_st_brush_priority, 7,
|
128
|
+
:ogr_st_brush_last, 8
|
129
|
+
|
130
|
+
OGRStyleToolParamSymbolID = enum :ogr_st_symbol_id, 0,
|
131
|
+
:ogr_st_symbol_angle, 1,
|
132
|
+
:ogr_st_symbol_color, 2,
|
133
|
+
:ogr_st_symbol_size, 3,
|
134
|
+
:ogr_st_symbol_dx, 4,
|
135
|
+
:ogr_st_symbol_dy, 5,
|
136
|
+
:ogr_st_symbol_step, 6,
|
137
|
+
:ogr_st_symbol_perp, 7,
|
138
|
+
:ogr_st_symbol_offset, 8,
|
139
|
+
:ogr_st_symbol_priority, 9,
|
140
|
+
:ogr_st_symbol_font_name, 10,
|
141
|
+
:ogr_st_symbol_o_color, 11,
|
142
|
+
:ogr_st_symbol_last, 12
|
143
|
+
|
144
|
+
OGRStyleToolParamLabelID = enum :ogr_st_label_font_name, 0,
|
145
|
+
:ogr_st_label_size, 1,
|
146
|
+
:ogr_st_label_text_string, 2,
|
147
|
+
:ogr_st_label_angle, 3,
|
148
|
+
:ogr_st_label_f_color, 4,
|
149
|
+
:ogr_st_label_b_color, 5,
|
150
|
+
:ogr_st_label_placement, 6,
|
151
|
+
:ogr_st_label_anchor, 7,
|
152
|
+
:ogr_st_label_dx, 8,
|
153
|
+
:ogr_st_label_dy, 9,
|
154
|
+
:ogr_st_label_perp, 10,
|
155
|
+
:ogr_st_label_bold, 11,
|
156
|
+
:ogr_st_label_italic, 12,
|
157
|
+
:ogr_st_label_underline, 13,
|
158
|
+
:ogr_st_label_priority, 14,
|
159
|
+
:ogr_st_label_strikeout, 15,
|
160
|
+
:ogr_st_label_stretch, 16,
|
161
|
+
:ogr_st_label_adj_hor, 17,
|
162
|
+
:ogr_st_label_adj_vert, 18,
|
163
|
+
:ogr_st_label_h_color, 19,
|
164
|
+
:ogr_st_label_o_color, 20,
|
165
|
+
:ogr_st_label_last, 21
|
166
|
+
|
167
|
+
#------------------------------------------------------------------------
|
168
|
+
# Typedefs
|
169
|
+
#------------------------------------------------------------------------
|
170
|
+
typedef :int, :OGRErr
|
171
|
+
typedef :int, :OGRBoolean
|
172
|
+
typedef OGRStyleToolClassID, :OGRSTClassId
|
173
|
+
typedef OGRStyleToolUnitsID, :OGRSTUnitId
|
174
|
+
typedef OGRStyleToolParamPenID, :OGRSTPenParam
|
175
|
+
typedef OGRStyleToolParamBrushID, :OGRSTBrushParam
|
176
|
+
typedef OGRStyleToolParamSymbolID, :OGRSTSymbolParam
|
177
|
+
typedef OGRStyleToolParamLabelID, :OGRSTLabelParam
|
178
|
+
|
179
|
+
#------------------------------------------------------------------------
|
180
|
+
# Functions
|
181
|
+
#------------------------------------------------------------------------
|
182
|
+
attach_function :OGRMalloc, [:size_t], :pointer
|
183
|
+
attach_function :OGRCalloc, [:size_t, :size_t], :pointer
|
184
|
+
attach_function :OGRRealloc, [:pointer, :size_t], :pointer
|
185
|
+
#attach_function :OGRStrdup, [:string], :string
|
186
|
+
attach_function :OGRFree, [:pointer], :void
|
187
|
+
attach_function :OGRGeometryTypeToName, [OGRwkbGeometryType], :string
|
188
|
+
attach_function :OGRMergeGeometryTypes,
|
189
|
+
[OGRwkbGeometryType, OGRwkbGeometryType],
|
190
|
+
OGRwkbGeometryType
|
191
|
+
attach_function :OGRParseDate, [:string, :pointer, :int], :int
|
192
|
+
attach_function :GDALVersionInfo, [:string], :string
|
193
|
+
attach_function :GDALCheckVersion, [:int, :int, :string], :int
|
198
194
|
end
|
199
195
|
end
|
data/lib/ffi/gdal/ogr_srs_api.rb
CHANGED
@@ -1,48 +1,44 @@
|
|
1
1
|
module FFI
|
2
2
|
module GDAL
|
3
|
-
module OGRSRSAPI
|
4
|
-
extend FFI::Library
|
5
|
-
ffi_lib 'gdal'
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
#------------------------------------------------------------------------
|
5
|
+
# Enums
|
6
|
+
#------------------------------------------------------------------------
|
7
|
+
OGRAxisOrientation = enum :oao_other, 0,
|
8
|
+
:oao_north, 1,
|
9
|
+
:oao_south, 2,
|
10
|
+
:oao_east, 3,
|
11
|
+
:oao_west, 4,
|
12
|
+
:oao_up, 5,
|
13
|
+
:oao_down, 6
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
15
|
+
OGRDatumType = enum :odt_hd_min, 1000,
|
16
|
+
:odt_hd_other, 1000,
|
17
|
+
:odt_hd_classic, 1001,
|
18
|
+
:odt_hd_geocentric, 1002,
|
19
|
+
:odt_hd_max, 1999,
|
20
|
+
:odt_vd_min, 2000,
|
21
|
+
:odt_vd_other, 2000,
|
22
|
+
:odt_vd_orthometric, 2001,
|
23
|
+
:odt_vd_ellipsoidal, 2002,
|
24
|
+
:odt_vd_altitude_barometric, 2003,
|
25
|
+
:odt_vd_normal, 2004,
|
26
|
+
:odt_vd_geoid_model_derived, 2005,
|
27
|
+
:odt_vd_depth, 2006,
|
28
|
+
:odt_vd_max, 2999,
|
29
|
+
:odt_ld_min, 10000,
|
30
|
+
:odt_ld_max, 32767
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
32
|
+
#------------------------------------------------------------------------
|
33
|
+
# Functions
|
34
|
+
#------------------------------------------------------------------------
|
35
|
+
attach_function :OSRAxisEnumToName, [OGRAxisOrientation], :string
|
36
|
+
#attach_function :OSRNewSpacialReference, [:string], :OGRSpatialReferenceH
|
37
|
+
#
|
38
|
+
attach_function :OPTGetProjectionMethods, [:void], :pointer
|
39
|
+
attach_function :OPTGetParameterList, [:string, :pointer], :pointer
|
40
|
+
attach_function :OPTGetParameterInfo,
|
41
|
+
[:string, :string, :pointer, :pointer, :pointer],
|
42
|
+
:int
|
47
43
|
end
|
48
44
|
end
|