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
@@ -1,151 +0,0 @@
1
- require_relative '../ffi/gdal'
2
- require_relative 'major_object'
3
- require 'multi_xml'
4
- require 'log_switch'
5
-
6
-
7
- module GDAL
8
- class Driver
9
- include FFI::GDAL
10
- include MajorObject
11
- include LogSwitch::Mixin
12
-
13
- GDAL_DOCS_URL = 'http://gdal.org'
14
-
15
- # @return [Fixnum]
16
- def self.driver_count
17
- FFI::GDAL.GDALGetDriverCount
18
- end
19
-
20
- # @return [GDAL::Driver]
21
- def self.by_name(name)
22
- new(name: name)
23
- end
24
-
25
- # Creates a new GDAL::Driver object based on the mutually exclusive given
26
- # parameters. Pass in only one of the allowed parameters.
27
- #
28
- # @param file_path [String] File to get the driver for.
29
- # @param name [String] Name of the registered GDALDriver.
30
- # @param index [Fixnum] Index of the registered driver. Must be less than
31
- # GDAL::Driver.driver_count.
32
- # @param dataset [FFI::Pointer] Pointer to the GDALDataset.
33
- def initialize(file_path: file_path, name: name, index: index, dataset: dataset)
34
- @gdal_driver_handle = if file_path
35
- GDALIdentifyDriver(::File.expand_path(file_path), nil)
36
- elsif name
37
- GDALGetDriverByName(name)
38
- elsif index
39
- count = self.class.driver_count
40
- raise "index must be between 0 and #{count - 1}." if index > count
41
-
42
- GDALGetDriver(index)
43
- elsif dataset
44
- GDALGetDatasetDriver(dataset)
45
- end
46
- end
47
-
48
- def c_pointer
49
- @gdal_driver_handle
50
- end
51
-
52
- # @return [String]
53
- def short_name
54
- return '' unless @gdal_driver_handle
55
-
56
- GDALGetDriverShortName(@gdal_driver_handle)
57
- end
58
-
59
- # @return [String]
60
- def long_name
61
- return '' unless @gdal_driver_handle
62
-
63
- GDALGetDriverLongName(@gdal_driver_handle)
64
- end
65
-
66
- # @return [String]
67
- def help_topic
68
- return '' unless @gdal_driver_handle
69
-
70
- "#{GDAL_DOCS_URL}/#{GDALGetDriverHelpTopic(@gdal_driver_handle)}"
71
- end
72
-
73
- # Lists and describes the options that can be used when calling
74
- # GDAL::Dataset.create or GDAL::Dataset.create_copy.
75
- #
76
- # @return [Array]
77
- def creation_option_list
78
- return [] unless @gdal_driver_handle
79
-
80
- creation_option_list_xml = GDALGetDriverCreationOptionList(@gdal_driver_handle)
81
- MultiXml.parse(creation_option_list_xml)['CreationOptionList']['Option']
82
- end
83
-
84
- # Copy all of the associated files of a dataset from one file to another.
85
- #
86
- # @param new_name [String]
87
- # @param old_name [String]
88
- # @return true on success, false on warning.
89
- # @raise [GDAL::CPLErrFailure] If failures.
90
- def copy_dataset_files(new_name, old_name)
91
- cpl_err = GDALCopyDatasetFiles(@gdal_driver_handle, new_name, old_name)
92
-
93
- cpl_err.to_bool
94
- end
95
-
96
- # Create a new Dataset with this driver. Legal arguments depend on the
97
- # driver and can't be retrieved programmatically.
98
- #
99
- # @param filename [String]
100
- # @param x_size [Fixnum] Width of created raster in pixels.
101
- # @param y_size [Fixnum] Height of created raster in pixels.
102
- # @param bands [Fixnum]
103
- # @param type [FFI::GDAL::GDALDataType]
104
- # @return [GDAL::Dataset] Returns the *closed* dataset. You'll need to
105
- # reopen it if you with to continue working with it.
106
- # @todo Implement options.
107
- def create_dataset(filename, x_size, y_size, bands: 1, type: :GDT_Byte, **options)
108
- log "creating dataset with size #{x_size},#{y_size}"
109
-
110
- dataset_pointer = GDALCreate(@gdal_driver_handle,
111
- filename,
112
- x_size,
113
- y_size,
114
- bands,
115
- type,
116
- nil
117
- )
118
-
119
- raise CreateFail if dataset_pointer.null?
120
-
121
- dataset = Dataset.new(dataset_pointer)
122
- yield(dataset) if block_given?
123
- dataset.close
124
-
125
- dataset
126
- end
127
-
128
- # Delete the dataset represented by +file_name+. Depending on the driver,
129
- # this could mean deleting associated files, database objects, etc.
130
- #
131
- # @param file_name [String]
132
- # @return true on success, false on warning.
133
- # @raise [GDAL::CPLErrFailure] If failures.
134
- def delete_dataset(file_name)
135
- cpl_err = GDALDeleteDataset(@gdal_driver_handle, file_name)
136
-
137
- cpl_err.to_bool
138
- end
139
-
140
- # @param new_name [String]
141
- # @param old_name [String]
142
- # @return true on success, false on warning.
143
- # @raise [GDAL::CPLErrFailure] If failures.
144
- def rename_dataset(new_name, old_name)
145
- cpl_err = GDALRenameDataset(@gdal_driver_handle, new_name, old_name)
146
-
147
-
148
- cpl_err.to_bool
149
- end
150
- end
151
- end
@@ -1,137 +0,0 @@
1
- require_relative '../ffi/gdal'
2
-
3
-
4
- module GDAL
5
- class GeoTransform
6
- include FFI::GDAL
7
-
8
- attr_accessor :gdal_dataset
9
-
10
- # @param gdal_dataset [FFI::Pointer]
11
- def initialize(dataset, geo_transform_pointer: nil)
12
- @gdal_dataset = if dataset.nil?
13
- FFI::MemoryPointer.new(:pointer)
14
- elsif dataset.is_a? GDAL::Dataset
15
- dataset.c_pointer
16
- else
17
- dataset
18
- end
19
-
20
- @gdal_geo_transform = if geo_transform_pointer
21
- geo_transform_pointer
22
- else
23
- container_pointer = FFI::MemoryPointer.new(:double, 6)
24
- GDALGetGeoTransform(@gdal_dataset, container_pointer).to_ruby
25
- container_pointer
26
- end
27
-
28
- to_a
29
- end
30
-
31
- def c_pointer
32
- @gdal_geo_transform
33
- end
34
-
35
- def null?
36
- @gdal_geo_transform.null?
37
- end
38
-
39
- # All attributes as an Array, in the order:
40
- # * x_origin
41
- # * pixel_width
42
- # * x_rotation
43
- # * y_origin
44
- # * y_rotation
45
- # * pixel_height
46
- #
47
- # @return [Array]
48
- def to_a
49
- [
50
- x_origin,
51
- pixel_width,
52
- x_rotation,
53
- y_origin,
54
- y_rotation,
55
- pixel_height
56
- ]
57
- end
58
-
59
- # X-coordinate of the center of the upper left pixel.
60
- # In wikipedia's World Map definition, this is "C".
61
- #
62
- # @return [Float]
63
- def x_origin
64
- return nil if null?
65
-
66
- @gdal_geo_transform[0].read_double
67
- end
68
-
69
- # AKA X-pixel size.
70
- # In wikipedia's World Map definition, this is "A".
71
- #
72
- # @return [Float]
73
- def pixel_width
74
- return nil if null?
75
-
76
- @gdal_geo_transform[1].read_double
77
- end
78
-
79
- # Rotation about the x-axis.
80
- # In wikipedia's World Map definition, this is "B".
81
- #
82
- # @return [Float]
83
- def x_rotation
84
- return nil if null?
85
-
86
- @gdal_geo_transform[2].read_double
87
- end
88
-
89
- # Y-coordinate of the center of the upper left pixel.
90
- # In wikipedia's World Map definition, this is "F".
91
- #
92
- # @return [Float]
93
- def y_origin
94
- return nil if null?
95
-
96
- @gdal_geo_transform[3].read_double
97
- end
98
-
99
- # Rotation about the y-axis.
100
- # In wikipedia's World Map definition, this is "D".
101
- #
102
- # @return [Float]
103
- def y_rotation
104
- return nil if null?
105
-
106
- @gdal_geo_transform[4].read_double
107
- end
108
-
109
- # AKA Y-pixel size.
110
- # In wikipedia's World Map definition, this is "E".
111
- #
112
- # @return [Float]
113
- def pixel_height
114
- return nil if null?
115
-
116
- @gdal_geo_transform[5].read_double
117
- end
118
-
119
- # The calculated UTM easting of the pixel on the map.
120
- #
121
- # @return [Float]
122
- def x_projection(x_pixel, y_pixel)
123
- return nil if null?
124
-
125
- (pixel_width * x_pixel) + (x_rotation * y_pixel) + x_origin
126
- end
127
-
128
- # The calculated UTM northing of the pixel on the map.
129
- #
130
- # @return [Float]
131
- def y_projection(x_pixel, y_pixel)
132
- return nil if null?
133
-
134
- (y_rotation * x_pixel) + (pixel_height * y_pixel) + y_origin
135
- end
136
- end
137
- end
@@ -1,78 +0,0 @@
1
- require_relative '../ffi/gdal'
2
-
3
-
4
- module GDAL
5
- class RasterAttributeTable
6
- include FFI::GDAL
7
-
8
- # @param raster_band [GDAL::RasterBand, FFI::Pointer]
9
- # @param raster_attribute_table_pointer [FFI::Pointer]
10
- def initialize(raster_band, raster_attribute_table_pointer: nil)
11
- @raster_band = if raster_band.is_a? GDAL::RasterBand
12
- raster_band.c_pointer
13
- else
14
- raster_band
15
- end
16
-
17
- @gdal_raster_attribute_table = if raster_attribute_table_pointer
18
- raster_attribute_table_pointer
19
- else
20
- GDALGetDefaultRAT(@raster_band)
21
- end
22
- end
23
-
24
- def c_pointer
25
- @gdal_raster_attribute_table
26
- end
27
-
28
- # @param index [Fixnum] The column number.
29
- # @return [Fixnum]
30
- def column_count
31
- GDALRATGetColumnCount(c_pointer)
32
- end
33
-
34
- # @param index [Fixnum] The column number.
35
- # @return [String]
36
- def columnn_name(index)
37
- GDALRATGetNameOfCol(c_pointer, index)
38
- end
39
-
40
- # @param index [Fixnum] The column number.
41
- # @return [GDALRATFieldUsage]
42
- def column_usage(index)
43
- GDALRATGetUsageOfCol(c_pointer, index)
44
- end
45
-
46
- # @param index [Fixnum] The column number.
47
- # @return [GDALRATFieldType]
48
- def column_type(index)
49
- GDALRATGetTypeOfCol(c_pointer, index)
50
- end
51
-
52
- # @param field_usage [GDALRATFieldUsage]
53
- # @return [Fixnum] The column number.
54
- def column_of_usage(field_usage)
55
- GDALRATGetColOfUsage(c_pointer, index)
56
- end
57
-
58
- # @param field_usage [GDALRATFieldUsage]
59
- # @return [Fixnum] The column number.
60
- def row_count
61
- GDALRATGetRowCount(c_pointer)
62
- end
63
-
64
- # @param entry_count [Fixnum] The number of entries to produce. The default
65
- # will try to auto-determine the number.
66
- # @return [GDAL::ColorTable]
67
- def to_color_table(entry_count = -1)
68
- color_table_pointer = GDALRATTranslateToColorTable(c_pointer, entry_count)
69
-
70
- GDAL::ColorTable.new(@raster_band, color_table_pointer: color_table_pointer)
71
- end
72
-
73
- # @param file_path [String]
74
- def dump_readable(file_path = 'stdout')
75
- GDALRATDumpReadable(c_pointer, file_path)
76
- end
77
- end
78
- end
@@ -1,21 +0,0 @@
1
- module FFI
2
- module GDAL
3
-
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
20
- end
21
- end
@@ -1,195 +0,0 @@
1
- module FFI
2
- module GDAL
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
194
- end
195
- end