ffi-gdal 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +15 -0
- data/.github/workflows/codacy.yml +1 -1
- data/.github/workflows/dependency-review.yml +1 -1
- data/.github/workflows/specs-in-docker.yml +3 -1
- data/.prettierrc.yml +4 -0
- data/.rubocop.yml +9 -5
- data/.rubocop_todo.yml +5 -11
- data/.solargraph.yml +13 -0
- data/Changelog-0.x.md +229 -174
- data/Changelog.md +20 -4
- data/Dockerfile.gdal2 +2 -85
- data/Gemfile +12 -2
- data/LICENSE.txt +1 -1
- data/README.md +14 -16
- data/Rakefile +6 -6
- data/bin/bundle +12 -12
- data/bin/rake +6 -6
- data/bin/rspec +6 -6
- data/bin/rubocop +6 -6
- data/examples/extract_and_colorize.rb +15 -15
- data/examples/geometries.rb +12 -12
- data/examples/gridding.rb +17 -17
- data/examples/ogr_layer_to_layer.rb +3 -3
- data/examples/raster_erasing.rb +9 -9
- data/examples/remove_small_polygons.rb +11 -11
- data/examples/testing_gdal.rb +20 -20
- data/examples/warping.rb +13 -13
- data/ffi-gdal.gemspec +16 -27
- data/lib/ext/ffi_library_function_checks.rb +3 -3
- data/lib/ext/narray_ext.rb +1 -1
- data/lib/ext/to_bool.rb +2 -2
- data/lib/ffi/cpl/conv.rb +2 -2
- data/lib/ffi/cpl/error.rb +1 -1
- data/lib/ffi/cpl/hash_set.rb +2 -2
- data/lib/ffi/cpl/http.rb +3 -3
- data/lib/ffi/cpl/http_result.rb +2 -2
- data/lib/ffi/cpl/list.rb +1 -1
- data/lib/ffi/cpl/mime_part.rb +1 -1
- data/lib/ffi/cpl/minixml.rb +2 -2
- data/lib/ffi/cpl/port.rb +1 -1
- data/lib/ffi/cpl/progress.rb +2 -2
- data/lib/ffi/cpl/quad_tree.rb +3 -3
- data/lib/ffi/cpl/rect_obj.rb +1 -1
- data/lib/ffi/cpl/string.rb +1 -1
- data/lib/ffi/cpl/vsi.rb +2 -2
- data/lib/ffi/cpl/xml_node.rb +1 -1
- data/lib/ffi/cpl.rb +11 -11
- data/lib/ffi/extensions/gdal/extensions/all.rb +2 -2
- data/lib/ffi/extensions/gdal/extensions.rb +2 -2
- data/lib/ffi/extensions/rttopo/gbox.rb +1 -1
- data/lib/ffi/extensions/rttopo/geom.rb +2 -2
- data/lib/ffi/extensions/rttopo.rb +3 -3
- data/lib/ffi/gdal/alg.rb +2 -2
- data/lib/ffi/gdal/color_entry.rb +1 -1
- data/lib/ffi/gdal/gcp.rb +1 -1
- data/lib/ffi/gdal/gdal.rb +3 -3
- data/lib/ffi/gdal/grid.rb +2 -2
- data/lib/ffi/gdal/grid_data_metrics_options.rb +1 -1
- data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +1 -1
- data/lib/ffi/gdal/grid_moving_average_options.rb +1 -1
- data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +1 -1
- data/lib/ffi/gdal/matching.rb +2 -2
- data/lib/ffi/gdal/rpc_info.rb +1 -1
- data/lib/ffi/gdal/transformer_info.rb +1 -1
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal/vrt.rb +2 -2
- data/lib/ffi/gdal/warp_options.rb +1 -1
- data/lib/ffi/gdal/warper.rb +2 -2
- data/lib/ffi/gdal.rb +22 -22
- data/lib/ffi/ogr/api.rb +3 -3
- data/lib/ffi/ogr/contour_writer_info.rb +1 -1
- data/lib/ffi/ogr/core.rb +9 -9
- data/lib/ffi/ogr/envelope.rb +1 -1
- data/lib/ffi/ogr/envelope_3d.rb +1 -1
- data/lib/ffi/ogr/featurestyle.rb +1 -1
- data/lib/ffi/ogr/field.rb +1 -1
- data/lib/ffi/ogr/geocoding.rb +2 -2
- data/lib/ffi/ogr/srs_api.rb +63 -63
- data/lib/ffi/ogr/style_param.rb +2 -2
- data/lib/ffi/ogr/style_value.rb +1 -1
- data/lib/ffi/ogr.rb +11 -11
- data/lib/ffi-gdal.rb +8 -8
- data/lib/gdal/color_table.rb +6 -6
- data/lib/gdal/dataset/accessors.rb +101 -0
- data/lib/gdal/{dataset_mixins → dataset}/algorithm_methods.rb +1 -1
- data/lib/gdal/dataset/class_methods.rb +69 -0
- data/lib/gdal/dataset/internal_functions.rb +22 -0
- data/lib/gdal/{dataset_mixins → dataset}/matching.rb +1 -1
- data/lib/gdal/dataset/raster_band_methods.rb +181 -0
- data/lib/gdal/{dataset_mixins → dataset}/warp_methods.rb +1 -1
- data/lib/gdal/dataset.rb +21 -359
- data/lib/gdal/driver.rb +10 -10
- data/lib/gdal/environment_methods.rb +1 -1
- data/lib/gdal/extensions/all.rb +1 -1
- data/lib/gdal/extensions/color_entry/extensions.rb +2 -2
- data/lib/gdal/extensions/color_table/extensions.rb +2 -2
- data/lib/gdal/extensions/dataset/extensions.rb +11 -11
- data/lib/gdal/extensions/driver/extensions.rb +7 -7
- data/lib/gdal/extensions/geo_transform/extensions.rb +2 -2
- data/lib/gdal/extensions/gridder.rb +8 -8
- data/lib/gdal/extensions/gridder_options.rb +6 -6
- data/lib/gdal/extensions/raster_attribute_table/extensions.rb +1 -1
- data/lib/gdal/extensions/raster_band/algorithm_extensions.rb +4 -4
- data/lib/gdal/extensions/raster_band/coloring_extensions.rb +1 -1
- data/lib/gdal/extensions/raster_band/extensions.rb +3 -3
- data/lib/gdal/extensions/raster_band/io_extensions.rb +4 -4
- data/lib/gdal/extensions/raster_band_classifier.rb +3 -3
- data/lib/gdal/geo_transform.rb +1 -1
- data/lib/gdal/grid.rb +6 -6
- data/lib/gdal/grid_algorithms/metric_average_distance.rb +1 -1
- data/lib/gdal/grid_algorithms/metric_average_distance_pts.rb +1 -1
- data/lib/gdal/grid_algorithms/metric_count.rb +1 -1
- data/lib/gdal/grid_algorithms/metric_maximum.rb +1 -1
- data/lib/gdal/grid_algorithms/metric_minimum.rb +1 -1
- data/lib/gdal/grid_algorithms/metric_range.rb +1 -1
- data/lib/gdal/grid_algorithms.rb +9 -9
- data/lib/gdal/internal_helpers.rb +3 -3
- data/lib/gdal/logger.rb +1 -1
- data/lib/gdal/major_object.rb +6 -6
- data/lib/gdal/options.rb +2 -2
- data/lib/gdal/raster_attribute_table.rb +5 -5
- data/lib/gdal/raster_band.rb +24 -24
- data/lib/gdal/rpc_info.rb +2 -2
- data/lib/gdal/transformer.rb +1 -1
- data/lib/gdal/transformers/general_image_projection_transformer.rb +1 -1
- data/lib/gdal/transformers/general_image_projection_transformer2.rb +1 -1
- data/lib/gdal/transformers/general_image_projection_transformer3.rb +1 -1
- data/lib/gdal/version_info.rb +9 -9
- data/lib/gdal/virtual_dataset.rb +4 -4
- data/lib/gdal/warp_operation.rb +2 -2
- data/lib/gdal/warp_options.rb +2 -2
- data/lib/gdal.rb +17 -17
- data/lib/ogr/coordinate_transformation.rb +5 -5
- data/lib/ogr/data_source.rb +9 -9
- data/lib/ogr/driver.rb +9 -9
- data/lib/ogr/envelope.rb +1 -1
- data/lib/ogr/error_handling.rb +1 -1
- data/lib/ogr/extensions/all.rb +1 -1
- data/lib/ogr/extensions/data_source/capability_methods.rb +4 -4
- data/lib/ogr/extensions/data_source/data_source_extensions.rb +1 -1
- data/lib/ogr/extensions/driver/capability_methods.rb +3 -3
- data/lib/ogr/extensions/envelope/extensions.rb +1 -1
- data/lib/ogr/extensions/feature/extensions.rb +1 -1
- data/lib/ogr/extensions/feature_definition/extensions.rb +1 -1
- data/lib/ogr/extensions/geometries/point/extensions.rb +1 -1
- data/lib/ogr/extensions/geometry/container_mixins.rb +10 -10
- data/lib/ogr/extensions/geometry/ewkb_io_extensions.rb +3 -3
- data/lib/ogr/extensions/geometry/ewkb_record.rb +4 -4
- data/lib/ogr/extensions/geometry/extensions.rb +4 -7
- data/lib/ogr/extensions/geometry/rttopo_extensions.rb +2 -2
- data/lib/ogr/extensions/geometry/wkb_record.rb +3 -3
- data/lib/ogr/extensions/geometry_types/curve/extensions.rb +2 -2
- data/lib/ogr/extensions/layer/capability_methods.rb +17 -17
- data/lib/ogr/extensions/layer/extensions.rb +1 -1
- data/lib/ogr/extensions/spatial_reference/extensions.rb +1 -1
- data/lib/ogr/extensions/spatial_reference/initializers.rb +2 -2
- data/lib/ogr/extensions/style_table/extensions.rb +1 -1
- data/lib/ogr/feature.rb +15 -15
- data/lib/ogr/feature_definition.rb +2 -2
- data/lib/ogr/field.rb +5 -5
- data/lib/ogr/field_definition.rb +1 -1
- data/lib/ogr/geocoder.rb +1 -1
- data/lib/ogr/geometries/geometry_collection.rb +2 -2
- data/lib/ogr/geometries/geometry_collection_25d.rb +1 -1
- data/lib/ogr/geometries/line_string.rb +1 -1
- data/lib/ogr/geometries/line_string_25d.rb +1 -1
- data/lib/ogr/geometries/linear_ring.rb +2 -2
- data/lib/ogr/geometries/multi_line_string.rb +2 -2
- data/lib/ogr/geometries/multi_line_string_25d.rb +1 -1
- data/lib/ogr/geometries/multi_point.rb +1 -1
- data/lib/ogr/geometries/multi_point_25d.rb +1 -1
- data/lib/ogr/geometries/multi_polygon.rb +2 -2
- data/lib/ogr/geometries/multi_polygon_25d.rb +1 -1
- data/lib/ogr/geometries/point_25d.rb +1 -1
- data/lib/ogr/geometries/polygon.rb +2 -2
- data/lib/ogr/geometries/polygon_25d.rb +1 -1
- data/lib/ogr/geometry.rb +11 -11
- data/lib/ogr/geometry_types/container.rb +1 -1
- data/lib/ogr/geometry_types/curve.rb +1 -1
- data/lib/ogr/internal_helpers.rb +4 -4
- data/lib/ogr/layer.rb +8 -8
- data/lib/ogr/layer_mixins/ogr_feature_methods.rb +9 -9
- data/lib/ogr/layer_mixins/ogr_field_methods.rb +15 -15
- data/lib/ogr/layer_mixins/ogr_sql_methods.rb +2 -2
- data/lib/ogr/spatial_reference.rb +19 -19
- data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +4 -4
- data/lib/ogr/spatial_reference_mixins/exporters.rb +9 -9
- data/lib/ogr/spatial_reference_mixins/importers.rb +2 -2
- data/lib/ogr/spatial_reference_mixins/morphers.rb +2 -2
- data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +1 -1
- data/lib/ogr/style_table.rb +3 -3
- data/lib/ogr/style_tool.rb +1 -1
- data/lib/ogr.rb +33 -33
- data/rakelib/docker.rake +2 -2
- metadata +14 -150
- data/bitbucket-pipelines.yml +0 -16
- data/tilt/gdal2.yml +0 -22
- data/tilt/gdal3.yml +0 -22
data/lib/ffi/gdal/matching.rb
CHANGED
data/lib/ffi/gdal/rpc_info.rb
CHANGED
data/lib/ffi/gdal/version.rb
CHANGED
data/lib/ffi/gdal/vrt.rb
CHANGED
data/lib/ffi/gdal/warper.rb
CHANGED
data/lib/ffi/gdal.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require_relative
|
6
|
-
require_relative
|
3
|
+
require "ffi"
|
4
|
+
require "ffi/tools/const_generator"
|
5
|
+
require_relative "gdal/exceptions"
|
6
|
+
require_relative "../ext/ffi_library_function_checks"
|
7
7
|
|
8
8
|
module FFI
|
9
9
|
module GDAL
|
10
10
|
extend ::FFI::Library
|
11
11
|
|
12
|
-
autoload :Alg, File.expand_path(
|
13
|
-
autoload :ColorEntry, File.expand_path(
|
14
|
-
autoload :GDAL, File.expand_path(
|
15
|
-
autoload :GCP, File.expand_path(
|
16
|
-
autoload :Grid, File.expand_path(
|
17
|
-
autoload :GridDataMetricsOptions, File.expand_path(
|
12
|
+
autoload :Alg, File.expand_path("gdal/alg.rb", __dir__)
|
13
|
+
autoload :ColorEntry, File.expand_path("gdal/color_entry.rb", __dir__)
|
14
|
+
autoload :GDAL, File.expand_path("gdal/gdal.rb", __dir__)
|
15
|
+
autoload :GCP, File.expand_path("gdal/gcp.rb", __dir__)
|
16
|
+
autoload :Grid, File.expand_path("gdal/grid.rb", __dir__)
|
17
|
+
autoload :GridDataMetricsOptions, File.expand_path("gdal/grid_data_metrics_options.rb", __dir__)
|
18
18
|
autoload :GridInverseDistanceToAPowerOptions,
|
19
|
-
File.expand_path(
|
20
|
-
autoload :GridMovingAverageOptions, File.expand_path(
|
21
|
-
autoload :GridNearestNeighborOptions, File.expand_path(
|
22
|
-
autoload :Matching, File.expand_path(
|
23
|
-
autoload :RPCInfo, File.expand_path(
|
24
|
-
autoload :TransformerInfo, File.expand_path(
|
25
|
-
autoload :VRT, File.expand_path(
|
26
|
-
autoload :Warper, File.expand_path(
|
27
|
-
autoload :WarpOptions, File.expand_path(
|
19
|
+
File.expand_path("gdal/grid_inverse_distance_to_a_power_options.rb", __dir__)
|
20
|
+
autoload :GridMovingAverageOptions, File.expand_path("gdal/grid_moving_average_options.rb", __dir__)
|
21
|
+
autoload :GridNearestNeighborOptions, File.expand_path("gdal/grid_nearest_neighbor_options.rb", __dir__)
|
22
|
+
autoload :Matching, File.expand_path("gdal/matching.rb", __dir__)
|
23
|
+
autoload :RPCInfo, File.expand_path("gdal/rpc_info.rb", __dir__)
|
24
|
+
autoload :TransformerInfo, File.expand_path("gdal/transformer_info.rb", __dir__)
|
25
|
+
autoload :VRT, File.expand_path("gdal/vrt.rb", __dir__)
|
26
|
+
autoload :Warper, File.expand_path("gdal/warper.rb", __dir__)
|
27
|
+
autoload :WarpOptions, File.expand_path("gdal/warp_options.rb", __dir__)
|
28
28
|
|
29
29
|
# @return [String]
|
30
30
|
def self.gdal_library_path
|
31
|
-
@gdal_library_path ||= ENV.fetch(
|
31
|
+
@gdal_library_path ||= ENV.fetch("GDAL_LIBRARY_PATH", "gdal")
|
32
32
|
end
|
33
33
|
|
34
34
|
# @return [Array<String>] Related files that contain C constants.
|
@@ -67,5 +67,5 @@ module FFI
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
require_relative
|
71
|
-
require_relative
|
70
|
+
require_relative "gdal/version"
|
71
|
+
require_relative "../ext/to_bool"
|
data/lib/ffi/ogr/api.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require "ffi"
|
4
|
+
require_relative "../gdal"
|
5
|
+
require_relative "../../ext/ffi_library_function_checks"
|
6
6
|
|
7
7
|
module FFI
|
8
8
|
module OGR
|
data/lib/ffi/ogr/core.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
3
|
+
require "ffi"
|
4
|
+
require_relative "../gdal"
|
5
|
+
require_relative "../../ext/ffi_library_function_checks"
|
6
|
+
require_relative "field"
|
7
7
|
|
8
8
|
module FFI
|
9
9
|
module OGR
|
@@ -150,11 +150,11 @@ module FFI
|
|
150
150
|
# Constants
|
151
151
|
#------------------------------------------------------------------------
|
152
152
|
OGR_ALTER = FFI::ConstGenerator.new do |gen|
|
153
|
-
gen.include FFI::GDAL._file_with_constants(
|
154
|
-
gen.const :ALTER_NAME_FLAG,
|
155
|
-
gen.const :ALTER_TYPE_FLAG,
|
156
|
-
gen.const :ALTER_WIDTH_PRECISION_FLAG,
|
157
|
-
gen.const :ALTER_ALL_FLAG,
|
153
|
+
gen.include FFI::GDAL._file_with_constants("ogr_core.h")
|
154
|
+
gen.const :ALTER_NAME_FLAG, "%x"
|
155
|
+
gen.const :ALTER_TYPE_FLAG, "%x"
|
156
|
+
gen.const :ALTER_WIDTH_PRECISION_FLAG, "%x"
|
157
|
+
gen.const :ALTER_ALL_FLAG, "%x"
|
158
158
|
end
|
159
159
|
OGR_ALTER.calculate
|
160
160
|
|
data/lib/ffi/ogr/envelope.rb
CHANGED
data/lib/ffi/ogr/envelope_3d.rb
CHANGED
data/lib/ffi/ogr/featurestyle.rb
CHANGED
data/lib/ffi/ogr/field.rb
CHANGED
data/lib/ffi/ogr/geocoding.rb
CHANGED
data/lib/ffi/ogr/srs_api.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require "ffi"
|
4
|
+
require_relative "../gdal"
|
5
|
+
require_relative "../../ext/ffi_library_function_checks"
|
6
6
|
|
7
7
|
module FFI
|
8
8
|
module OGR
|
@@ -41,70 +41,70 @@ module FFI
|
|
41
41
|
# -----------------------------------------------------------------------
|
42
42
|
# Constants
|
43
43
|
# -----------------------------------------------------------------------
|
44
|
-
SRS_UL = FFI::ConstGenerator.new(
|
45
|
-
gen.include FFI::GDAL._file_with_constants(
|
46
|
-
gen.const :SRS_UL_METER,
|
47
|
-
gen.const :SRS_UL_FOOT,
|
48
|
-
gen.const :SRS_UL_FOOT_CONV,
|
49
|
-
gen.const :SRS_UL_NAUTICAL_MILE,
|
50
|
-
gen.const :SRS_UL_NAUTICAL_MILE_CONV,
|
51
|
-
gen.const :SRS_UL_LINK,
|
52
|
-
gen.const :SRS_UL_LINK_CONV,
|
53
|
-
gen.const :SRS_UL_CHAIN,
|
54
|
-
gen.const :SRS_UL_CHAIN_CONV,
|
55
|
-
gen.const :SRS_UL_ROD,
|
56
|
-
gen.const :SRS_UL_ROD_CONV,
|
57
|
-
gen.const :SRS_UL_LINK_Clarke,
|
58
|
-
gen.const :SRS_UL_LINK_Clarke_CONV,
|
59
|
-
gen.const :SRS_UL_KILOMETER,
|
60
|
-
gen.const :SRS_UL_KILOMETER_CONV,
|
61
|
-
gen.const :SRS_UL_DECIMETER,
|
62
|
-
gen.const :SRS_UL_DECIMETER_CONV,
|
63
|
-
gen.const :SRS_UL_CENTIMETER,
|
64
|
-
gen.const :SRS_UL_CENTIMETER_CONV,
|
65
|
-
gen.const :SRS_UL_MILLIMETER,
|
66
|
-
gen.const :SRS_UL_MILLIMETER_CONV,
|
67
|
-
gen.const :SRS_UL_INTL_NAUT_MILE,
|
68
|
-
gen.const :SRS_UL_INTL_NAUT_MILE_CONV,
|
69
|
-
gen.const :SRS_UL_INTL_INCH,
|
70
|
-
gen.const :SRS_UL_INTL_INCH_CONV,
|
71
|
-
gen.const :SRS_UL_INTL_FOOT,
|
72
|
-
gen.const :SRS_UL_INTL_FOOT_CONV,
|
73
|
-
gen.const :SRS_UL_INTL_YARD,
|
74
|
-
gen.const :SRS_UL_INTL_YARD_CONV,
|
75
|
-
gen.const :SRS_UL_INTL_STAT_MILE,
|
76
|
-
gen.const :SRS_UL_INTL_STAT_MILE_CONV,
|
77
|
-
gen.const :SRS_UL_INTL_FATHOM,
|
78
|
-
gen.const :SRS_UL_INTL_FATHOM_CONV,
|
79
|
-
gen.const :SRS_UL_INTL_CHAIN,
|
80
|
-
gen.const :SRS_UL_INTL_CHAIN_CONV,
|
81
|
-
gen.const :SRS_UL_INTL_LINK,
|
82
|
-
gen.const :SRS_UL_INTL_LINK_CONV,
|
83
|
-
gen.const :SRS_UL_US_INCH,
|
84
|
-
gen.const :SRS_UL_US_INCH_CONV,
|
85
|
-
gen.const :SRS_UL_US_FOOT,
|
86
|
-
gen.const :SRS_UL_US_FOOT_CONV,
|
87
|
-
gen.const :SRS_UL_US_YARD,
|
88
|
-
gen.const :SRS_UL_US_YARD_CONV,
|
89
|
-
gen.const :SRS_UL_US_CHAIN,
|
90
|
-
gen.const :SRS_UL_US_CHAIN_CONV,
|
91
|
-
gen.const :SRS_UL_US_STAT_MILE,
|
92
|
-
gen.const :SRS_UL_US_STAT_MILE_CONV,
|
93
|
-
gen.const :SRS_UL_INDIAN_YARD,
|
94
|
-
gen.const :SRS_UL_INDIAN_YARD_CONV,
|
95
|
-
gen.const :SRS_UL_INDIAN_FOOT,
|
96
|
-
gen.const :SRS_UL_INDIAN_FOOT_CONV,
|
97
|
-
gen.const :SRS_UL_INDIAN_CHAIN,
|
98
|
-
gen.const :SRS_UL_INDIAN_CHAIN_CONV,
|
44
|
+
SRS_UL = FFI::ConstGenerator.new("SRS_UL") do |gen| # rubocop:disable Metrics/BlockLength
|
45
|
+
gen.include FFI::GDAL._file_with_constants("ogr_srs_api.h")
|
46
|
+
gen.const :SRS_UL_METER, "%s", nil, :METER_LABEL, &:inspect
|
47
|
+
gen.const :SRS_UL_FOOT, "%s", nil, :FOOT_LABEL, &:inspect
|
48
|
+
gen.const :SRS_UL_FOOT_CONV, "%s", nil, :METER_TO_FOOT, &:to_f
|
49
|
+
gen.const :SRS_UL_NAUTICAL_MILE, "%s", nil, :NAUTICAL_MILE_LABEL, &:inspect
|
50
|
+
gen.const :SRS_UL_NAUTICAL_MILE_CONV, "%s", nil, :METER_TO_NAUTICAL_MILE, &:to_f
|
51
|
+
gen.const :SRS_UL_LINK, "%s", nil, :LINK_LABEL, &:inspect
|
52
|
+
gen.const :SRS_UL_LINK_CONV, "%s", nil, :METER_TO_LINK, &:to_f
|
53
|
+
gen.const :SRS_UL_CHAIN, "%s", nil, :CHAIN_LABEL, &:inspect
|
54
|
+
gen.const :SRS_UL_CHAIN_CONV, "%s", nil, :METER_TO_CHAIN, &:to_f
|
55
|
+
gen.const :SRS_UL_ROD, "%s", nil, :ROD_LABEL, &:inspect
|
56
|
+
gen.const :SRS_UL_ROD_CONV, "%s", nil, :METER_TO_ROD, &:to_f
|
57
|
+
gen.const :SRS_UL_LINK_Clarke, "%s", nil, :LINK_CLARKE_LABEL, &:inspect
|
58
|
+
gen.const :SRS_UL_LINK_Clarke_CONV, "%s", nil, :METER_TO_LINK_CLARKE, &:to_f
|
59
|
+
gen.const :SRS_UL_KILOMETER, "%s", nil, :KILOMETER_LABEL, &:inspect
|
60
|
+
gen.const :SRS_UL_KILOMETER_CONV, "%s", nil, :METER_TO_KILOMETER, &:to_f
|
61
|
+
gen.const :SRS_UL_DECIMETER, "%s", nil, :DECIMETER_LABEL, &:inspect
|
62
|
+
gen.const :SRS_UL_DECIMETER_CONV, "%s", nil, :METER_TO_DECIMETER, &:to_f
|
63
|
+
gen.const :SRS_UL_CENTIMETER, "%s", nil, :CENTIMETER_LABEL, &:inspect
|
64
|
+
gen.const :SRS_UL_CENTIMETER_CONV, "%s", nil, :METER_TO_CENTIMETER, &:to_f
|
65
|
+
gen.const :SRS_UL_MILLIMETER, "%s", nil, :MILLIMETER_LABEL, &:inspect
|
66
|
+
gen.const :SRS_UL_MILLIMETER_CONV, "%s", nil, :METER_TO_MILLIMETER, &:to_f
|
67
|
+
gen.const :SRS_UL_INTL_NAUT_MILE, "%s", nil, :INTL_NAUTICAL_MILE_LABEL, &:inspect
|
68
|
+
gen.const :SRS_UL_INTL_NAUT_MILE_CONV, "%s", nil, :METER_TO_INTL_NAUTICAL_MILE, &:to_f
|
69
|
+
gen.const :SRS_UL_INTL_INCH, "%s", nil, :INTL_INCH_LABEL, &:inspect
|
70
|
+
gen.const :SRS_UL_INTL_INCH_CONV, "%s", nil, :METER_TO_INTL_INCH, &:to_f
|
71
|
+
gen.const :SRS_UL_INTL_FOOT, "%s", nil, :INTL_FOOT_LABEL, &:inspect
|
72
|
+
gen.const :SRS_UL_INTL_FOOT_CONV, "%s", nil, :METER_TO_INTL_FOOT, &:to_f
|
73
|
+
gen.const :SRS_UL_INTL_YARD, "%s", nil, :INTL_YARD_LABEL, &:inspect
|
74
|
+
gen.const :SRS_UL_INTL_YARD_CONV, "%s", nil, :METER_TO_INTL_YARD, &:to_f
|
75
|
+
gen.const :SRS_UL_INTL_STAT_MILE, "%s", nil, :INTL_STATUTE_MILE_LABEL, &:inspect
|
76
|
+
gen.const :SRS_UL_INTL_STAT_MILE_CONV, "%s", nil, :METER_TO_INTL_STATUTE_MILE, &:to_f
|
77
|
+
gen.const :SRS_UL_INTL_FATHOM, "%s", nil, :INTL_FATHOM_LABEL, &:inspect
|
78
|
+
gen.const :SRS_UL_INTL_FATHOM_CONV, "%s", nil, :METER_TO_INTL_FATHOM, &:to_f
|
79
|
+
gen.const :SRS_UL_INTL_CHAIN, "%s", nil, :INTL_CHAIN_LABEL, &:inspect
|
80
|
+
gen.const :SRS_UL_INTL_CHAIN_CONV, "%s", nil, :METER_TO_INTL_CHAIN, &:to_f
|
81
|
+
gen.const :SRS_UL_INTL_LINK, "%s", nil, :INTL_LINK_LABEL, &:inspect
|
82
|
+
gen.const :SRS_UL_INTL_LINK_CONV, "%s", nil, :METER_TO_INTL_LINK, &:to_f
|
83
|
+
gen.const :SRS_UL_US_INCH, "%s", nil, :US_INCH_LABEL, &:inspect
|
84
|
+
gen.const :SRS_UL_US_INCH_CONV, "%s", nil, :METER_TO_US_INCH, &:to_f
|
85
|
+
gen.const :SRS_UL_US_FOOT, "%s", nil, :US_FOOT_LABEL, &:inspect
|
86
|
+
gen.const :SRS_UL_US_FOOT_CONV, "%s", nil, :METER_TO_US_FOOT, &:to_f
|
87
|
+
gen.const :SRS_UL_US_YARD, "%s", nil, :US_YARD_LABEL, &:inspect
|
88
|
+
gen.const :SRS_UL_US_YARD_CONV, "%s", nil, :METER_TO_US_YARD, &:to_f
|
89
|
+
gen.const :SRS_UL_US_CHAIN, "%s", nil, :US_CHAIN_LABEL, &:inspect
|
90
|
+
gen.const :SRS_UL_US_CHAIN_CONV, "%s", nil, :METER_TO_US_CHAIN, &:to_f
|
91
|
+
gen.const :SRS_UL_US_STAT_MILE, "%s", nil, :US_STATUTE_MILE_LABEL, &:inspect
|
92
|
+
gen.const :SRS_UL_US_STAT_MILE_CONV, "%s", nil, :METER_TO_US_STATUTE_MILE, &:to_f
|
93
|
+
gen.const :SRS_UL_INDIAN_YARD, "%s", nil, :INDIAN_YARD_LABEL, &:inspect
|
94
|
+
gen.const :SRS_UL_INDIAN_YARD_CONV, "%s", nil, :METER_TO_INDIAN_YARD, &:to_f
|
95
|
+
gen.const :SRS_UL_INDIAN_FOOT, "%s", nil, :INDIAN_FOOT_LABEL, &:inspect
|
96
|
+
gen.const :SRS_UL_INDIAN_FOOT_CONV, "%s", nil, :METER_TO_INDIAN_FOOT, &:to_f
|
97
|
+
gen.const :SRS_UL_INDIAN_CHAIN, "%s", nil, :INDIAN_CHAIN_LABEL, &:inspect
|
98
|
+
gen.const :SRS_UL_INDIAN_CHAIN_CONV, "%s", nil, :METER_TO_INDIAN_CHAIN, &:to_f
|
99
99
|
end
|
100
100
|
|
101
101
|
SRS_UL.calculate
|
102
102
|
|
103
|
-
SRS_UA = FFI::ConstGenerator.new(
|
104
|
-
gen.include FFI::GDAL._file_with_constants(
|
105
|
-
gen.const :SRS_UA_DEGREE,
|
106
|
-
gen.const :SRS_UA_DEGREE_CONV,
|
107
|
-
gen.const :SRS_UA_RADIAN,
|
103
|
+
SRS_UA = FFI::ConstGenerator.new("SRS_UL") do |gen|
|
104
|
+
gen.include FFI::GDAL._file_with_constants("ogr_srs_api.h")
|
105
|
+
gen.const :SRS_UA_DEGREE, "%s", nil, :DEGREE_LABEL, &:inspect
|
106
|
+
gen.const :SRS_UA_DEGREE_CONV, "%s", nil, :RADIAN_TO_DEGREE, &:to_f
|
107
|
+
gen.const :SRS_UA_RADIAN, "%s", nil, :RADIAN_LABEL, &:inspect
|
108
108
|
end
|
109
109
|
SRS_UA.calculate
|
110
110
|
|
data/lib/ffi/ogr/style_param.rb
CHANGED
data/lib/ffi/ogr/style_value.rb
CHANGED
data/lib/ffi/ogr.rb
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
module FFI
|
4
4
|
module OGR
|
5
|
-
autoload :API, File.expand_path(
|
6
|
-
autoload :Core, File.expand_path(
|
7
|
-
autoload :ContourWriterInfo, File.expand_path(
|
8
|
-
autoload :Envelope, File.expand_path(
|
9
|
-
autoload :Envelope3D, File.expand_path(
|
10
|
-
autoload :Featurestyle, File.expand_path(
|
11
|
-
autoload :Field, File.expand_path(
|
12
|
-
autoload :Geocoding, File.expand_path(
|
13
|
-
autoload :SRSAPI, File.expand_path(
|
14
|
-
autoload :StyleParam, File.expand_path(
|
15
|
-
autoload :StyleValue, File.expand_path(
|
5
|
+
autoload :API, File.expand_path("ogr/api.rb", __dir__)
|
6
|
+
autoload :Core, File.expand_path("ogr/core.rb", __dir__)
|
7
|
+
autoload :ContourWriterInfo, File.expand_path("ogr/contour_writer_info.rb", __dir__)
|
8
|
+
autoload :Envelope, File.expand_path("ogr/envelope.rb", __dir__)
|
9
|
+
autoload :Envelope3D, File.expand_path("ogr/envelope_3d.rb", __dir__)
|
10
|
+
autoload :Featurestyle, File.expand_path("ogr/featurestyle.rb", __dir__)
|
11
|
+
autoload :Field, File.expand_path("ogr/field.rb", __dir__)
|
12
|
+
autoload :Geocoding, File.expand_path("ogr/geocoding.rb", __dir__)
|
13
|
+
autoload :SRSAPI, File.expand_path("ogr/srs_api.rb", __dir__)
|
14
|
+
autoload :StyleParam, File.expand_path("ogr/style_param.rb", __dir__)
|
15
|
+
autoload :StyleValue, File.expand_path("ogr/style_value.rb", __dir__)
|
16
16
|
end
|
17
17
|
end
|
data/lib/ffi-gdal.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
3
|
+
require "ffi"
|
4
|
+
require_relative "ext/ffi_library_function_checks"
|
5
|
+
require_relative "ext/narray_ext"
|
6
|
+
require_relative "ext/numeric_as_data_type"
|
7
|
+
require_relative "ext/float_ext"
|
8
8
|
|
9
9
|
module FFI
|
10
|
-
autoload :CPL, File.expand_path(
|
11
|
-
autoload :GDAL, File.expand_path(
|
12
|
-
autoload :OGR, File.expand_path(
|
10
|
+
autoload :CPL, File.expand_path("ffi/cpl.rb", __dir__)
|
11
|
+
autoload :GDAL, File.expand_path("ffi/gdal.rb", __dir__)
|
12
|
+
autoload :OGR, File.expand_path("ffi/ogr.rb", __dir__)
|
13
13
|
end
|
data/lib/gdal/color_table.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative "../gdal"
|
4
|
+
require_relative "color_entry"
|
5
5
|
|
6
6
|
module GDAL
|
7
7
|
module ColorTableTypes
|
8
8
|
autoload :CMYK,
|
9
|
-
File.expand_path(
|
9
|
+
File.expand_path("color_table_types/cmyk", __dir__)
|
10
10
|
autoload :Gray,
|
11
|
-
File.expand_path(
|
11
|
+
File.expand_path("color_table_types/gray", __dir__)
|
12
12
|
autoload :HLS,
|
13
|
-
File.expand_path(
|
13
|
+
File.expand_path("color_table_types/hls", __dir__)
|
14
14
|
autoload :RGB,
|
15
|
-
File.expand_path(
|
15
|
+
File.expand_path("color_table_types/rgb", __dir__)
|
16
16
|
end
|
17
17
|
|
18
18
|
class ColorTable
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GDAL
|
4
|
+
class Dataset
|
5
|
+
module Accessors
|
6
|
+
# @return [GDAL::Driver] The driver to be used for working with this
|
7
|
+
# dataset.
|
8
|
+
def driver
|
9
|
+
driver_ptr = FFI::GDAL::GDAL.GDALGetDatasetDriver(@c_pointer)
|
10
|
+
|
11
|
+
Driver.new(driver_ptr)
|
12
|
+
end
|
13
|
+
|
14
|
+
def projection
|
15
|
+
# Returns a pointer to an internal projection reference string. It should
|
16
|
+
# not be altered, freed or expected to last for long.
|
17
|
+
proj, ptr = FFI::GDAL::GDAL.GDALGetProjectionRef(@c_pointer)
|
18
|
+
ptr.autorelease = false
|
19
|
+
|
20
|
+
proj || ""
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param new_projection [String] Should be in WKT or PROJ.4 format.
|
24
|
+
# @raise [GDAL::Error]
|
25
|
+
def projection=(new_projection)
|
26
|
+
GDAL::CPLErrorHandler.manually_handle("Unable to set projection") do
|
27
|
+
FFI::GDAL::GDAL.GDALSetProjection(@c_pointer, new_projection.to_s)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [GDAL::GeoTransform]
|
32
|
+
# @raise [GDAL::Error]
|
33
|
+
def geo_transform
|
34
|
+
return @geo_transform if @geo_transform
|
35
|
+
|
36
|
+
geo_transform_pointer = GDAL::GeoTransform.new_pointer
|
37
|
+
|
38
|
+
GDAL::CPLErrorHandler.manually_handle("Unable to get geo_transform") do
|
39
|
+
FFI::GDAL::GDAL.GDALGetGeoTransform(@c_pointer, geo_transform_pointer)
|
40
|
+
end
|
41
|
+
|
42
|
+
@geo_transform = GeoTransform.new(geo_transform_pointer)
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param new_transform [GDAL::GeoTransform, FFI::Pointer]
|
46
|
+
# @return [GDAL::GeoTransform]
|
47
|
+
# @raise [GDAL::Error]
|
48
|
+
def geo_transform=(new_transform)
|
49
|
+
new_pointer = GDAL._pointer(GDAL::GeoTransform, new_transform)
|
50
|
+
|
51
|
+
GDAL::CPLErrorHandler.manually_handle("Unable to set geo_transform") do
|
52
|
+
FFI::GDAL::GDAL.GDALSetGeoTransform(@c_pointer, new_pointer)
|
53
|
+
end
|
54
|
+
|
55
|
+
@geo_transform = new_transform.is_a?(FFI::Pointer) ? GeoTransform.new(new_pointer) : new_transform
|
56
|
+
end
|
57
|
+
|
58
|
+
# @return [String # @return [Integer]
|
59
|
+
def gcp_count
|
60
|
+
return 0 if null?
|
61
|
+
|
62
|
+
FFI::GDAL::GDAL.GDALGetGCPCount(@c_pointer)
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [String]
|
66
|
+
def gcp_projection
|
67
|
+
return "" if null?
|
68
|
+
|
69
|
+
proj, ptr = FFI::GDAL::GDAL.GDALGetGCPProjection(@c_pointer)
|
70
|
+
ptr.autorelease = false
|
71
|
+
|
72
|
+
proj
|
73
|
+
end
|
74
|
+
|
75
|
+
# @return [FFI::GDAL::GCP]
|
76
|
+
def gcps
|
77
|
+
return FFI::GDAL::GCP.new if null?
|
78
|
+
|
79
|
+
gcp_array_pointer = FFI::GDAL::GDAL.GDALGetGCPs(@c_pointer)
|
80
|
+
|
81
|
+
if gcp_array_pointer.null?
|
82
|
+
FFI::GDAL::GCP.new
|
83
|
+
else
|
84
|
+
FFI::GDAL::GCP.new(gcp_array_pointer)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Creates a OGR::SpatialReference object from the dataset's projection.
|
89
|
+
#
|
90
|
+
# @return [OGR::SpatialReference]
|
91
|
+
def spatial_reference
|
92
|
+
return @spatial_reference if @spatial_reference
|
93
|
+
|
94
|
+
proj = projection
|
95
|
+
return nil if proj.empty?
|
96
|
+
|
97
|
+
@spatial_reference = OGR::SpatialReference.new(proj)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|