ffi-gdal 1.0.0.beta16 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +17 -0
- data/.github/workflows/codacy.yml +61 -0
- data/.github/workflows/codeql.yml +74 -0
- data/.github/workflows/continuous-integration.yml +36 -0
- data/.github/workflows/dependency-review.yml +20 -0
- data/.github/workflows/specs-in-docker.yml +27 -0
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/.rubocop.yml +10 -80
- data/.rubocop_todo.yml +23 -40
- data/.ruby-version +1 -1
- data/Changelog-0.x.md +512 -0
- data/Changelog.md +12 -0
- data/Dockerfile.gdal2 +110 -0
- data/Dockerfile.gdal3 +73 -0
- data/README.md +25 -14
- data/Rakefile +0 -8
- data/Tiltfile +91 -0
- data/bin/bundle +123 -0
- data/bin/docker-clean +8 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/docker-compose.yml +25 -0
- data/examples/extract_and_colorize.rb +0 -13
- data/examples/geometries.rb +14 -14
- data/examples/ogr_layer_to_layer.rb +1 -3
- data/examples/raster_erasing.rb +1 -0
- data/examples/remove_small_polygons.rb +1 -1
- data/examples/testing_gdal.rb +20 -17
- data/examples/warping.rb +9 -7
- data/ffi-gdal.gemspec +12 -6
- data/lib/ext/ffi_library_function_checks.rb +2 -2
- data/lib/ext/to_bool.rb +5 -3
- data/lib/ffi/cpl/conv.rb +27 -25
- data/lib/ffi/cpl/error.rb +19 -20
- data/lib/ffi/cpl/hash_set.rb +4 -4
- data/lib/ffi/cpl/http.rb +3 -3
- data/lib/ffi/cpl/http_result.rb +8 -8
- data/lib/ffi/cpl/list.rb +1 -1
- data/lib/ffi/cpl/mime_part.rb +2 -2
- data/lib/ffi/cpl/minixml.rb +7 -7
- data/lib/ffi/cpl/progress.rb +8 -8
- data/lib/ffi/cpl/quad_tree.rb +14 -14
- data/lib/ffi/cpl/rect_obj.rb +3 -3
- data/lib/ffi/cpl/string.rb +17 -20
- data/lib/ffi/cpl/vsi.rb +13 -13
- data/lib/ffi/cpl/xml_node.rb +3 -3
- data/lib/ffi/extensions/gdal/extensions/all.rb +4 -0
- data/lib/ffi/extensions/gdal/extensions/version.rb +9 -0
- data/lib/ffi/extensions/gdal/extensions.rb +12 -0
- data/lib/ffi/extensions/rttopo/gbox.rb +19 -0
- data/lib/ffi/extensions/rttopo/geom.rb +16 -0
- data/lib/ffi/extensions/rttopo.rb +41 -0
- data/lib/ffi/gdal/alg.rb +277 -277
- data/lib/ffi/gdal/color_entry.rb +3 -3
- data/lib/ffi/gdal/gcp.rb +6 -6
- data/lib/ffi/gdal/gdal.rb +349 -349
- data/lib/ffi/gdal/grid.rb +134 -134
- data/lib/ffi/gdal/grid_data_metrics_options.rb +4 -4
- data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +9 -9
- data/lib/ffi/gdal/grid_moving_average_options.rb +4 -4
- data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +3 -3
- data/lib/ffi/gdal/matching.rb +3 -3
- data/lib/ffi/gdal/rpc_info.rb +17 -17
- data/lib/ffi/gdal/transformer_info.rb +4 -4
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal/vrt.rb +39 -39
- data/lib/ffi/gdal/warp_options.rb +34 -34
- data/lib/ffi/gdal/warper.rb +90 -90
- data/lib/ffi/gdal.rb +2 -31
- data/lib/ffi/ogr/api.rb +175 -167
- data/lib/ffi/ogr/contour_writer_info.rb +4 -4
- data/lib/ffi/ogr/core.rb +107 -107
- data/lib/ffi/ogr/envelope.rb +3 -3
- data/lib/ffi/ogr/envelope_3d.rb +5 -5
- data/lib/ffi/ogr/featurestyle.rb +3 -3
- data/lib/ffi/ogr/field.rb +22 -22
- data/lib/ffi/ogr/geocoding.rb +4 -4
- data/lib/ffi/ogr/srs_api.rb +154 -155
- data/lib/ffi/ogr/style_param.rb +3 -3
- data/lib/ffi/ogr/style_value.rb +4 -4
- data/lib/gdal/color_entry.rb +1 -5
- data/lib/gdal/color_interpretation.rb +7 -3
- data/lib/gdal/color_table.rb +46 -27
- data/lib/gdal/cpl_error_handler.rb +26 -6
- data/lib/gdal/data_type.rb +10 -3
- data/lib/gdal/dataset.rb +171 -85
- data/lib/gdal/dataset_mixins/algorithm_methods.rb +44 -44
- data/lib/gdal/dataset_mixins/matching.rb +1 -1
- data/lib/gdal/dataset_mixins/warp_methods.rb +4 -2
- data/lib/gdal/driver.rb +38 -21
- data/lib/gdal/environment_methods.rb +6 -6
- data/lib/gdal/extensions/all.rb +3 -0
- data/lib/gdal/{color_entry_mixins → extensions/color_entry}/extensions.rb +4 -1
- data/lib/gdal/{color_table_mixins → extensions/color_table}/extensions.rb +3 -0
- data/lib/gdal/extensions/dataset/extensions.rb +205 -0
- data/lib/gdal/{driver_mixins → extensions/driver}/extensions.rb +6 -2
- data/lib/gdal/{geo_transform_mixins → extensions/geo_transform}/extensions.rb +10 -8
- data/lib/gdal/{gridder → extensions/gridder}/point_extracting.rb +7 -5
- data/lib/gdal/{gridder.rb → extensions/gridder.rb} +33 -33
- data/lib/gdal/{gridder_options.rb → extensions/gridder_options.rb} +13 -14
- data/lib/gdal/{raster_attribute_table_mixins → extensions/raster_attribute_table}/extensions.rb +8 -6
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/algorithm_extensions.rb +8 -6
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/coloring_extensions.rb +6 -4
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/extensions.rb +9 -5
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/io_extensions.rb +18 -14
- data/lib/gdal/{raster_band_classifier.rb → extensions/raster_band_classifier.rb} +3 -5
- data/lib/gdal/geo_transform.rb +1 -6
- data/lib/gdal/grid.rb +3 -2
- data/lib/gdal/grid_algorithms.rb +9 -9
- data/lib/gdal/internal_helpers.rb +46 -9
- data/lib/gdal/major_object.rb +11 -3
- data/lib/gdal/options.rb +26 -32
- data/lib/gdal/raster_attribute_table.rb +63 -37
- data/lib/gdal/raster_band.rb +164 -116
- data/lib/gdal/raster_band_mixins/algorithm_methods.rb +26 -25
- data/lib/gdal/rpc_info.rb +3 -2
- data/lib/gdal/transformers/approximate_transformer.rb +12 -3
- data/lib/gdal/transformers/base_general_image_projection_transformer.rb +15 -2
- data/lib/gdal/transformers/gcp_transformer.rb +27 -19
- data/lib/gdal/transformers/general_image_projection_transformer.rb +8 -6
- data/lib/gdal/transformers/general_image_projection_transformer2.rb +9 -6
- data/lib/gdal/transformers/general_image_projection_transformer3.rb +6 -2
- data/lib/gdal/transformers/geolocation_transformer.rb +12 -4
- data/lib/gdal/transformers/reprojection_transformer.rb +11 -3
- data/lib/gdal/transformers/rpc_transformer.rb +11 -2
- data/lib/gdal/transformers/tps_transformer.rb +12 -4
- data/lib/gdal/version_info.rb +2 -2
- data/lib/gdal/virtual_dataset.rb +2 -0
- data/lib/gdal/warp_operation.rb +65 -54
- data/lib/gdal/warp_options.rb +9 -11
- data/lib/ogr/coordinate_transformation.rb +23 -9
- data/lib/ogr/data_source.rb +68 -37
- data/lib/ogr/driver.rb +18 -17
- data/lib/ogr/envelope.rb +0 -3
- data/lib/ogr/error_handling.rb +22 -24
- data/lib/ogr/extensions/all.rb +3 -0
- data/lib/ogr/{data_source_mixins → extensions/data_source}/capability_methods.rb +2 -0
- data/lib/ogr/extensions/data_source/data_source_extensions.rb +16 -0
- data/lib/ogr/{driver_mixins → extensions/driver}/capability_methods.rb +5 -1
- data/lib/ogr/extensions/envelope/extensions.rb +114 -0
- data/lib/ogr/extensions/feature/extensions.rb +87 -0
- data/lib/ogr/extensions/feature_definition/extensions.rb +43 -0
- data/lib/ogr/extensions/geometries/point/extensions.rb +19 -0
- data/lib/ogr/extensions/geometry/container_mixins.rb +56 -0
- data/lib/ogr/extensions/geometry/ewkb_io_extensions.rb +44 -0
- data/lib/ogr/extensions/geometry/ewkb_record.rb +94 -0
- data/lib/ogr/{geometry_mixins → extensions/geometry}/extensions.rb +16 -9
- data/lib/ogr/extensions/geometry/rttopo_extensions.rb +48 -0
- data/lib/ogr/extensions/geometry/wkb_record.rb +63 -0
- data/lib/ogr/extensions/geometry_types/curve/extensions.rb +68 -0
- data/lib/ogr/{layer_mixins → extensions/layer}/capability_methods.rb +4 -0
- data/lib/ogr/{layer_mixins → extensions/layer}/extensions.rb +11 -6
- data/lib/ogr/extensions/spatial_reference/extensions.rb +38 -0
- data/lib/ogr/extensions/spatial_reference/initializers.rb +138 -0
- data/lib/ogr/extensions/style_table/extensions.rb +31 -0
- data/lib/ogr/feature.rb +173 -88
- data/lib/ogr/feature_definition.rb +53 -45
- data/lib/ogr/field.rb +17 -19
- data/lib/ogr/field_definition.rb +30 -18
- data/lib/ogr/geocoder.rb +11 -4
- data/lib/ogr/geometries/line_string.rb +1 -0
- data/lib/ogr/geometries/line_string_25d.rb +0 -9
- data/lib/ogr/geometries/linear_ring.rb +2 -2
- data/lib/ogr/geometries/point.rb +0 -9
- data/lib/ogr/geometry.rb +116 -49
- data/lib/ogr/geometry_field_definition.rb +31 -15
- data/lib/ogr/geometry_types/container.rb +26 -28
- data/lib/ogr/geometry_types/curve.rb +5 -61
- data/lib/ogr/geometry_types/surface.rb +1 -1
- data/lib/ogr/internal_helpers.rb +2 -2
- data/lib/ogr/layer.rb +12 -10
- data/lib/ogr/layer_mixins/ogr_feature_methods.rb +39 -27
- data/lib/ogr/layer_mixins/ogr_field_methods.rb +66 -50
- data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +17 -8
- data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +7 -6
- data/lib/ogr/layer_mixins/ogr_sql_methods.rb +15 -7
- data/lib/ogr/spatial_reference.rb +79 -42
- data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +149 -118
- data/lib/ogr/spatial_reference_mixins/exporters.rb +87 -51
- data/lib/ogr/spatial_reference_mixins/importers.rb +88 -43
- data/lib/ogr/spatial_reference_mixins/morphers.rb +12 -8
- data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +27 -13
- data/lib/ogr/style_table.rb +15 -5
- data/lib/ogr/style_tool.rb +29 -15
- data/lib/ogr.rb +1 -0
- data/rakelib/docker.rake +10 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +21790 -0
- data/tilt/gdal2.yml +22 -0
- data/tilt/gdal3.yml +22 -0
- metadata +116 -280
- data/History.md +0 -360
- data/lib/ext/error_symbols.rb +0 -7
- data/lib/gdal/dataset_mixins/extensions.rb +0 -380
- data/lib/gdal/merger.rb +0 -132
- data/lib/ogr/data_source_extensions.rb +0 -10
- data/lib/ogr/envelope_extensions.rb +0 -110
- data/lib/ogr/feature_definition_extensions.rb +0 -39
- data/lib/ogr/feature_extensions.rb +0 -87
- data/lib/ogr/geometry_mixins/container_mixins.rb +0 -25
- data/lib/ogr/spatial_reference_extensions.rb +0 -34
- data/lib/ogr/style_table_extensions.rb +0 -26
- data/spec/ffi-gdal_spec.rb +0 -24
- data/spec/integration/gdal/color_table_info_spec.rb +0 -78
- data/spec/integration/gdal/dataset_info_spec.rb +0 -342
- data/spec/integration/gdal/driver_info_spec.rb +0 -170
- data/spec/integration/gdal/geo_transform_info_spec.rb +0 -226
- data/spec/integration/gdal/gridder_spec.rb +0 -331
- data/spec/integration/gdal/raster_attribute_table_info_spec.rb +0 -229
- data/spec/integration/gdal/raster_band_algorithms_spec.rb +0 -35
- data/spec/integration/gdal/raster_band_info_spec.rb +0 -320
- data/spec/integration/ogr/layer_spec.rb +0 -95
- data/spec/spec_helper.rb +0 -116
- data/spec/support/images/123.tiff +0 -0
- data/spec/support/images/osgeo/gdal/data/hfa/float-rle.img +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.lgo +0 -31
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif.msk +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.txt +0 -10
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.tif +0 -0
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.txt +0 -84
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.lgo +0 -45
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.tif +0 -0
- data/spec/support/integration_help.rb +0 -34
- data/spec/support/shapefiles/states_21basic/states.dbf +0 -0
- data/spec/support/shapefiles/states_21basic/states.prj +0 -1
- data/spec/support/shapefiles/states_21basic/states.sbn +0 -0
- data/spec/support/shapefiles/states_21basic/states.sbx +0 -0
- data/spec/support/shapefiles/states_21basic/states.shp +0 -0
- data/spec/support/shapefiles/states_21basic/states.shp.xml +0 -3
- data/spec/support/shapefiles/states_21basic/states.shx +0 -0
- data/spec/support/shared_contexts.rb +0 -28
- data/spec/support/shared_examples/gdal/major_object_examples.rb +0 -55
- data/spec/support/shared_examples/ogr/a_25d_geometry.rb +0 -9
- data/spec/support/shared_examples/ogr/a_container_geometry.rb +0 -49
- data/spec/support/shared_examples/ogr/a_geometry.rb +0 -406
- data/spec/support/shared_examples/ogr/a_line_string.rb +0 -18
- data/spec/support/test_style_table.txt +0 -3
- data/spec/support/worldfiles/SR_50M/SR_50M.VERSION.txt +0 -1
- data/spec/support/worldfiles/SR_50M/SR_50M.prj +0 -1
- data/spec/support/worldfiles/SR_50M/SR_50M.tfw +0 -6
- data/spec/support/worldfiles/SR_50M/SR_50M.tif +0 -0
- data/spec/unit/ext/error_symbols_spec.rb +0 -69
- data/spec/unit/ext/numeric_as_data_type_spec.rb +0 -115
- data/spec/unit/ffi/gdal_spec.rb +0 -73
- data/spec/unit/gdal/color_entry_spec.rb +0 -8
- data/spec/unit/gdal/color_interpretation_spec.rb +0 -8
- data/spec/unit/gdal/color_table_mixins/extensions_spec.rb +0 -62
- data/spec/unit/gdal/color_table_spec.rb +0 -146
- data/spec/unit/gdal/data_type_spec.rb +0 -74
- data/spec/unit/gdal/dataset_mixins/warp_methods_spec.rb +0 -55
- data/spec/unit/gdal/dataset_spec.rb +0 -148
- data/spec/unit/gdal/driver_mixins/extensions_spec.rb +0 -24
- data/spec/unit/gdal/driver_spec.rb +0 -51
- data/spec/unit/gdal/environment_methods_spec.rb +0 -8
- data/spec/unit/gdal/geo_transform_mixins/extensions_spec.rb +0 -69
- data/spec/unit/gdal/geo_transform_spec.rb +0 -265
- data/spec/unit/gdal/grid_spec.rb +0 -98
- data/spec/unit/gdal/gridder/point_extracting_spec.rb +0 -101
- data/spec/unit/gdal/gridder_options_spec.rb +0 -185
- data/spec/unit/gdal/gridder_spec.rb +0 -182
- data/spec/unit/gdal/internal_helpers_spec.rb +0 -278
- data/spec/unit/gdal/major_object_spec.rb +0 -10
- data/spec/unit/gdal/options_spec.rb +0 -33
- data/spec/unit/gdal/raster_attribute_table_spec.rb +0 -7
- data/spec/unit/gdal/raster_band_classifier_spec.rb +0 -260
- data/spec/unit/gdal/raster_band_mixins/extensions_spec.rb +0 -73
- data/spec/unit/gdal/raster_band_mixins/io_extensions_spec.rb +0 -135
- data/spec/unit/gdal/raster_band_spec.rb +0 -8
- data/spec/unit/gdal/rpc_info_spec.rb +0 -8
- data/spec/unit/gdal/version_info_spec.rb +0 -10
- data/spec/unit/gdal/virtual_dataset_spec.rb +0 -34
- data/spec/unit/gdal/warp_operation_spec.rb +0 -8
- data/spec/unit/gdal/warp_options_spec.rb +0 -338
- data/spec/unit/ogr/coordinate_transformation_spec.rb +0 -104
- data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +0 -32
- data/spec/unit/ogr/data_source_spec.rb +0 -223
- data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +0 -20
- data/spec/unit/ogr/driver_spec.rb +0 -152
- data/spec/unit/ogr/envelope_spec.rb +0 -324
- data/spec/unit/ogr/feature_definition_spec.rb +0 -296
- data/spec/unit/ogr/feature_extensions_spec.rb +0 -90
- data/spec/unit/ogr/feature_spec.rb +0 -363
- data/spec/unit/ogr/field_definition_spec.rb +0 -118
- data/spec/unit/ogr/field_spec.rb +0 -195
- data/spec/unit/ogr/geometries/geometry_collection_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/geometry_collection_spec.rb +0 -188
- data/spec/unit/ogr/geometries/line_string_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/line_string_spec.rb +0 -107
- data/spec/unit/ogr/geometries/linear_ring_spec.rb +0 -92
- data/spec/unit/ogr/geometries/multi_line_string_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_line_string_spec.rb +0 -16
- data/spec/unit/ogr/geometries/multi_point_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_point_spec.rb +0 -16
- data/spec/unit/ogr/geometries/multi_polygon_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_polygon_spec.rb +0 -43
- data/spec/unit/ogr/geometries/none_geometry_spec.rb +0 -14
- data/spec/unit/ogr/geometries/point_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/point_spec.rb +0 -307
- data/spec/unit/ogr/geometries/polygon_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/polygon_spec.rb +0 -19
- data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +0 -12
- data/spec/unit/ogr/geometry_field_definition_spec.rb +0 -73
- data/spec/unit/ogr/geometry_spec.rb +0 -711
- data/spec/unit/ogr/internal_helpers_spec.rb +0 -70
- data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +0 -90
- data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +0 -155
- data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +0 -434
- data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +0 -22
- data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +0 -44
- data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +0 -14
- data/spec/unit/ogr/layer_spec.rb +0 -98
- data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +0 -48
- data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +0 -151
- data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +0 -40
- data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +0 -38
- data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +0 -105
- data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +0 -159
- data/spec/unit/ogr/spatial_reference_spec.rb +0 -44
- data/spec/unit/ogr/style_table_spec.rb +0 -108
- data/spec/unit/ogr/style_tool_spec.rb +0 -159
- data/spec/unit/version_info_spec.rb +0 -50
data/lib/ogr/internal_helpers.rb
CHANGED
@@ -28,7 +28,7 @@ module OGR
|
|
28
28
|
#
|
29
29
|
# This converts the OGR integer into something usable by Ruby's DateTime.
|
30
30
|
#
|
31
|
-
# @param time_zone [
|
31
|
+
# @param time_zone [Integer]
|
32
32
|
def _format_time_zone_for_ruby(time_zone)
|
33
33
|
case time_zone
|
34
34
|
when 0 then nil
|
@@ -47,7 +47,7 @@ module OGR
|
|
47
47
|
#
|
48
48
|
# @param time_zone [String]
|
49
49
|
def _format_time_zone_for_ogr(time_zone)
|
50
|
-
if
|
50
|
+
if /(00:00|GMT)\z/.match?(time_zone)
|
51
51
|
100
|
52
52
|
elsif time_zone
|
53
53
|
1
|
data/lib/ogr/layer.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
require_relative '../ogr'
|
4
4
|
require_relative '../gdal'
|
5
|
-
require_relative 'layer_mixins/extensions'
|
6
|
-
require_relative 'layer_mixins/capability_methods'
|
7
5
|
require_relative 'layer_mixins/ogr_feature_methods'
|
8
6
|
require_relative 'layer_mixins/ogr_field_methods'
|
9
7
|
require_relative 'layer_mixins/ogr_layer_method_methods'
|
@@ -14,8 +12,6 @@ module OGR
|
|
14
12
|
class Layer
|
15
13
|
include GDAL::MajorObject
|
16
14
|
include GDAL::Logger
|
17
|
-
include LayerMixins::Extensions
|
18
|
-
include LayerMixins::CapabilityMethods
|
19
15
|
include LayerMixins::OGRFeatureMethods
|
20
16
|
include LayerMixins::OGRFieldMethods
|
21
17
|
include LayerMixins::OGRLayerMethodMethods
|
@@ -36,16 +32,19 @@ module OGR
|
|
36
32
|
|
37
33
|
# @return [String]
|
38
34
|
def name
|
39
|
-
FFI::OGR::API.OGR_L_GetName(@c_pointer)
|
35
|
+
name, ptr = FFI::OGR::API.OGR_L_GetName(@c_pointer)
|
36
|
+
ptr.autorelease = false
|
37
|
+
|
38
|
+
name
|
40
39
|
end
|
41
40
|
|
42
41
|
# @return [Boolean]
|
43
42
|
# TODO: This seems to occasionally lead to: 28352 illegal hardware
|
44
43
|
# instruction, and sometimes full crashes.
|
45
44
|
def sync_to_disk
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
OGR::ErrorHandling.handle_ogr_err('Unable to sync layer to disk') do
|
46
|
+
FFI::OGR::API.OGR_L_SyncToDisk(@c_pointer)
|
47
|
+
end
|
49
48
|
end
|
50
49
|
|
51
50
|
# Tests if this layer supports the given capability. Must be in the list
|
@@ -58,6 +57,9 @@ module OGR
|
|
58
57
|
FFI::OGR::API.OGR_L_TestCapability(@c_pointer, capability.to_s)
|
59
58
|
end
|
60
59
|
|
60
|
+
# NOTE: This SpatialReference is owned by the Layer and should thus not be
|
61
|
+
# modified.
|
62
|
+
#
|
61
63
|
# @return [OGR::SpatialReference]
|
62
64
|
def spatial_reference
|
63
65
|
spatial_ref_pointer = FFI::OGR::API.OGR_L_GetSpatialRef(@c_pointer)
|
@@ -67,7 +69,7 @@ module OGR
|
|
67
69
|
end
|
68
70
|
|
69
71
|
# @return [OGR::Envelope]
|
70
|
-
def extent(force
|
72
|
+
def extent(force: true)
|
71
73
|
envelope = FFI::OGR::Envelope.new
|
72
74
|
FFI::OGR::API.OGR_L_GetExtent(@c_pointer, envelope, force)
|
73
75
|
return nil if envelope.null?
|
@@ -76,7 +78,7 @@ module OGR
|
|
76
78
|
end
|
77
79
|
|
78
80
|
# @return [OGR::Envelope]
|
79
|
-
def extent_by_geometry(geometry_field_index, force
|
81
|
+
def extent_by_geometry(geometry_field_index, force: true)
|
80
82
|
envelope = FFI::OGR::Envelope.new
|
81
83
|
FFI::OGR::API.OGR_L_GetExtentEx(@c_pointer, geometry_field_index, envelope, force)
|
82
84
|
return nil if envelope.null?
|
@@ -8,6 +8,8 @@ module OGR
|
|
8
8
|
# @return [OGR::FeatureDefinition,nil]
|
9
9
|
def definition
|
10
10
|
feature_defn_pointer = FFI::OGR::API.OGR_L_GetLayerDefn(@c_pointer)
|
11
|
+
feature_defn_pointer.autorelease = false
|
12
|
+
|
11
13
|
return nil if feature_defn_pointer.null?
|
12
14
|
|
13
15
|
# This object should not be modified.
|
@@ -23,58 +25,68 @@ module OGR
|
|
23
25
|
# layer.create_feature(feature)
|
24
26
|
#
|
25
27
|
# @param feature [OGR::Feature] [description]
|
26
|
-
# @
|
28
|
+
# @raise [OGR::Failure]
|
27
29
|
def create_feature(feature)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
unless test_capability('SequentialWrite')
|
31
|
+
raise OGR::UnsupportedOperation,
|
32
|
+
'This layer does not support feature creation.'
|
33
|
+
end
|
34
|
+
|
35
|
+
OGR::ErrorHandling.handle_ogr_err('Unable to create feature') do
|
36
|
+
FFI::OGR::API.OGR_L_CreateFeature(@c_pointer, feature.c_pointer)
|
37
|
+
end
|
33
38
|
end
|
34
39
|
|
35
40
|
# Deletes the feature from the layer.
|
36
41
|
#
|
37
|
-
# @param feature_id [
|
38
|
-
# @return +true+ if successful, otherwise raises an OGR exception.
|
42
|
+
# @param feature_id [Integer] ID of the Feature to delete.
|
39
43
|
# @raise [OGR::Failure] When trying to delete a feature with an ID that
|
40
44
|
# does not exist.
|
41
45
|
def delete_feature(feature_id)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
unless test_capability('DeleteFeature')
|
47
|
+
raise OGR::UnsupportedOperation,
|
48
|
+
'This layer does not support feature deletion.'
|
49
|
+
end
|
50
|
+
|
51
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to delete feature with ID '#{feature_id}'") do
|
52
|
+
FFI::OGR::API.OGR_L_DeleteFeature(@c_pointer, feature_id)
|
53
|
+
end
|
47
54
|
end
|
48
55
|
|
49
56
|
# The number of features in this layer. If +force+ is false and it would be
|
50
57
|
# expensive to determine the feature count, -1 may be returned.
|
51
58
|
#
|
52
59
|
# @param force [Boolean] Force the calculation even if it's expensive.
|
53
|
-
# @return [
|
54
|
-
def feature_count(force
|
60
|
+
# @return [Integer]
|
61
|
+
def feature_count(force: true)
|
55
62
|
FFI::OGR::API.OGR_L_GetFeatureCount(@c_pointer, force)
|
56
63
|
end
|
57
64
|
|
58
65
|
# Rewrites an existing feature using the ID within the given Feature.
|
59
66
|
#
|
60
67
|
# @param new_feature [OGR::Feature, FFI::Pointer]
|
68
|
+
# @raise [OGR::Failure]
|
61
69
|
def feature=(new_feature)
|
62
|
-
raise OGR::UnsupportedOperation, '#feature= not supported by this Layer' unless
|
70
|
+
raise OGR::UnsupportedOperation, '#feature= not supported by this Layer' unless test_capability('RandomWrite')
|
63
71
|
|
64
72
|
new_feature_ptr = GDAL._pointer(OGR::Feature, new_feature)
|
65
73
|
raise OGR::InvalidFeature if new_feature_ptr.nil? || new_feature_ptr.null?
|
66
74
|
|
67
|
-
|
68
|
-
|
69
|
-
|
75
|
+
OGR::ErrorHandling.handle_ogr_err('Unable to set feature') do
|
76
|
+
FFI::OGR::API.OGR_L_SetFeature(@c_pointer, new_feature_ptr)
|
77
|
+
end
|
70
78
|
end
|
71
79
|
|
72
|
-
# @param index [
|
80
|
+
# @param index [Integer] The 0-based index of the feature to get. It should
|
73
81
|
# be <= +feature_count+, but no checking is done to ensure.
|
74
82
|
# @return [OGR::Feature, nil]
|
75
83
|
def feature(index)
|
76
|
-
|
84
|
+
unless test_capability('RandomRead')
|
85
|
+
raise OGR::UnsupportedOperation,
|
86
|
+
'#feature(index) not supported by this Layer'
|
87
|
+
end
|
77
88
|
|
89
|
+
# This feature needs to be Destroyed.
|
78
90
|
feature_pointer = FFI::OGR::API.OGR_L_GetFeature(@c_pointer, index)
|
79
91
|
return nil if feature_pointer.null?
|
80
92
|
|
@@ -98,16 +110,16 @@ module OGR
|
|
98
110
|
|
99
111
|
# Sets the index for #next_feature.
|
100
112
|
#
|
101
|
-
# @param feature_index [
|
102
|
-
# @
|
113
|
+
# @param feature_index [Integer]
|
114
|
+
# @raise [OGR::Failure]
|
103
115
|
def next_feature_index=(feature_index)
|
104
|
-
|
105
|
-
|
106
|
-
|
116
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to set next feature index to #{feature_index}") do
|
117
|
+
FFI::OGR::API.OGR_L_SetNextByIndex(@c_pointer, feature_index)
|
118
|
+
end
|
107
119
|
end
|
108
120
|
alias set_next_by_index next_feature_index=
|
109
121
|
|
110
|
-
# @return [
|
122
|
+
# @return [Integer]
|
111
123
|
def features_read
|
112
124
|
FFI::OGR::API.OGR_L_GetFeaturesRead(@c_pointer)
|
113
125
|
end
|
@@ -10,75 +10,90 @@ module OGR
|
|
10
10
|
# @param field_definition [OGR::FieldDefinition]
|
11
11
|
# @param approx_ok [Boolean] If +true+ the field may be created in a slightly
|
12
12
|
# different form, depending on the limitations of the format driver.
|
13
|
-
# @
|
14
|
-
def create_field(field_definition, approx_ok
|
15
|
-
|
13
|
+
# @raise [OGR::Failure]
|
14
|
+
def create_field(field_definition, approx_ok: false)
|
15
|
+
unless test_capability('CreateField')
|
16
|
+
raise OGR::UnsupportedOperation,
|
17
|
+
'This layer does not support field creation.'
|
18
|
+
end
|
16
19
|
|
17
20
|
field_definition_ptr = GDAL._pointer(OGR::FieldDefinition, field_definition)
|
18
|
-
ogr_err = FFI::OGR::API.OGR_L_CreateField(@c_pointer, field_definition_ptr, approx_ok)
|
19
21
|
|
20
|
-
|
22
|
+
OGR::ErrorHandling.handle_ogr_err('Unable to create field') do
|
23
|
+
FFI::OGR::API.OGR_L_CreateField(@c_pointer, field_definition_ptr, approx_ok)
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
# Deletes the field definition from the layer.
|
24
28
|
#
|
25
|
-
# @
|
29
|
+
# @raise [OGR::Failure]
|
26
30
|
def delete_field(field_id)
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
unless test_capability('DeleteField')
|
32
|
+
raise OGR::UnsupportedOperation,
|
33
|
+
'This driver does not support field deletion.'
|
34
|
+
end
|
30
35
|
|
31
|
-
|
36
|
+
OGR::ErrorHandling.handle_ogr_err('Unable to delete field') do
|
37
|
+
FFI::OGR::API.OGR_L_DeleteField(@c_pointer, field_id)
|
38
|
+
end
|
32
39
|
end
|
33
40
|
|
34
|
-
# @param new_order [Array<
|
41
|
+
# @param new_order [Array<Integer>] An array that orders field indexes by
|
35
42
|
# which they should be reordered. I.e. [0, 2, 3, 1, 4].
|
36
|
-
# @
|
43
|
+
# @raise [OGR::Failure]
|
37
44
|
def reorder_fields(*new_order)
|
38
|
-
|
45
|
+
unless test_capability('ReorderFields')
|
46
|
+
raise OGR::UnsupportedOperation,
|
47
|
+
'This driver does not support field reordering.'
|
48
|
+
end
|
39
49
|
|
40
|
-
return false if new_order.empty?
|
41
|
-
return false if new_order.any? { |i| i > feature_definition.field_count }
|
50
|
+
return false if new_order.empty? || new_order.any? { |i| i > feature_definition.field_count }
|
42
51
|
|
43
52
|
map_array_ptr = FFI::MemoryPointer.new(:int, new_order.size).write_array_of_int(new_order)
|
44
|
-
ogr_err = FFI::OGR::API.OGR_L_ReorderFields(@c_pointer, map_array_ptr)
|
45
53
|
|
46
|
-
|
54
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to reorder fields using order: #{new_order}") do
|
55
|
+
FFI::OGR::API.OGR_L_ReorderFields(@c_pointer, map_array_ptr)
|
56
|
+
end
|
47
57
|
end
|
48
58
|
|
49
59
|
# Puts the field whose index is +old_position+ into index at +new_position+
|
50
60
|
# and shuffles the other indexes accordingly.
|
51
61
|
#
|
52
|
-
# @param old_position [
|
53
|
-
# @param new_position [
|
62
|
+
# @param old_position [Integer]
|
63
|
+
# @param new_position [Integer]
|
64
|
+
# @raise [OGR::Failure]
|
54
65
|
def reorder_field(old_position, new_position)
|
55
|
-
|
56
|
-
|
57
|
-
|
66
|
+
unless test_capability('ReorderFields')
|
67
|
+
raise OGR::UnsupportedOperation,
|
68
|
+
'This driver does not support field reordering.'
|
69
|
+
end
|
58
70
|
|
59
|
-
|
71
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to reorder field: #{old_position} to #{new_position}") do
|
72
|
+
FFI::OGR::API.OGR_L_ReorderField(@c_pointer, old_position, new_position)
|
73
|
+
end
|
60
74
|
end
|
61
75
|
|
62
|
-
# @param field_index [
|
76
|
+
# @param field_index [Integer]
|
63
77
|
# @param new_field_definition [OGR::FieldDefinition] The definition for
|
64
78
|
# which to base the Field at +field_index+ off of.
|
65
|
-
# @param flags [
|
79
|
+
# @param flags [Integer] ALTER_NAME_FLAG, ALTER_TYPE_FLAG,
|
66
80
|
# ALTER_WIDTH_PRECISION_FLAG, or ALTER_ALL_FLAG.
|
81
|
+
# @raise [OGR::Failure]
|
67
82
|
def alter_field_definition(field_index, new_field_definition, flags)
|
68
|
-
unless
|
83
|
+
unless test_capability('AlterFieldDefn')
|
69
84
|
raise OGR::UnsupportedOperation, 'This layer does not support field definition altering.'
|
70
85
|
end
|
71
86
|
|
72
87
|
new_field_definition_ptr = GDAL._pointer(OGR::FieldDefinition, new_field_definition)
|
73
88
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
89
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to alter field definition at field index #{field_index}") do
|
90
|
+
FFI::OGR::API.OGR_L_AlterFieldDefn(
|
91
|
+
@c_pointer,
|
92
|
+
field_index,
|
93
|
+
new_field_definition_ptr,
|
94
|
+
flags
|
95
|
+
)
|
96
|
+
end
|
82
97
|
end
|
83
98
|
|
84
99
|
# Finds the index of a field in this Layer.
|
@@ -86,11 +101,11 @@ module OGR
|
|
86
101
|
# @param field_name [String]
|
87
102
|
# @param exact_match [Boolean] If +false+ and the field doesn't exist in the
|
88
103
|
# given form, the driver will try to make changes to make a match.
|
89
|
-
# @return [
|
90
|
-
def find_field_index(field_name, exact_match
|
104
|
+
# @return [Integer] Index of the field or +nil+ if the field doesn't exist.
|
105
|
+
def find_field_index(field_name, exact_match: true)
|
91
106
|
result = FFI::OGR::API.OGR_L_FindFieldIndex(@c_pointer, field_name, exact_match)
|
92
107
|
|
93
|
-
result
|
108
|
+
result.negative? ? nil : result
|
94
109
|
end
|
95
110
|
|
96
111
|
# Creates and writes a new geometry to the layer. Note: not all drivers
|
@@ -99,21 +114,21 @@ module OGR
|
|
99
114
|
# @param geometry_field_def [OGR::GeometryFieldDefinition] The definition
|
100
115
|
# to use for creating the new field.
|
101
116
|
# @param approx_ok [Boolean]
|
102
|
-
# @
|
103
|
-
def create_geometry_field(geometry_field_def, approx_ok
|
104
|
-
unless
|
117
|
+
# @raise [OGR::Failure]
|
118
|
+
def create_geometry_field(geometry_field_def, approx_ok: false)
|
119
|
+
unless test_capability('CreateGeomField')
|
105
120
|
raise OGR::UnsupportedOperation, 'This layer does not support geometry field creation'
|
106
121
|
end
|
107
122
|
|
108
123
|
geometry_field_definition_ptr = GDAL._pointer(OGR::GeometryFieldDefinition, geometry_field_def)
|
109
124
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
125
|
+
OGR::ErrorHandling.handle_ogr_err('Unable to create geometry field') do
|
126
|
+
FFI::OGR::API.OGR_L_CreateGeomField(
|
127
|
+
@c_pointer,
|
128
|
+
geometry_field_definition_ptr,
|
129
|
+
approx_ok
|
130
|
+
)
|
131
|
+
end
|
117
132
|
end
|
118
133
|
|
119
134
|
# If the driver supports this functionality, it will not fetch the
|
@@ -121,14 +136,15 @@ module OGR
|
|
121
136
|
# thus save some processing time and/or bandwidth.
|
122
137
|
#
|
123
138
|
# @param field_names [Array<String>]
|
124
|
-
# @
|
139
|
+
# @raise [OGR::Failure]
|
125
140
|
def set_ignored_fields(*field_names)
|
126
141
|
return false if field_names.empty?
|
127
142
|
|
128
143
|
fields_ptr = GDAL._string_array_to_pointer(field_names)
|
129
|
-
ogr_err = FFI::OGR::API.OGR_L_SetIgnoredFields(@c_pointer, fields_ptr)
|
130
144
|
|
131
|
-
|
145
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to ignore fields with names: #{field_names}") do
|
146
|
+
FFI::OGR::API.OGR_L_SetIgnoredFields(@c_pointer, fields_ptr)
|
147
|
+
end
|
132
148
|
end
|
133
149
|
end
|
134
150
|
end
|
@@ -22,6 +22,7 @@ module OGR
|
|
22
22
|
# that will be created from the fields of the input Layer.
|
23
23
|
# @option options [String] method_prefix Set a prefix for the field names
|
24
24
|
# that will be created from the fields of the method Layer.
|
25
|
+
# @raise [OGR::Failure]
|
25
26
|
def clip(method_layer, output_layer, **options, &progress)
|
26
27
|
run_layer_method(:OGR_L_Clip, method_layer, output_layer, **options, &progress)
|
27
28
|
end
|
@@ -42,6 +43,7 @@ module OGR
|
|
42
43
|
# that will be created from the fields of the input Layer.
|
43
44
|
# @option options [String] method_prefix Set a prefix for the field names
|
44
45
|
# that will be created from the fields of the method Layer.
|
46
|
+
# @raise [OGR::Failure]
|
45
47
|
def erase(method_layer, output_layer, **options, &progress)
|
46
48
|
run_layer_method(:OGR_L_Erase, method_layer, output_layer, **options, &progress)
|
47
49
|
end
|
@@ -60,6 +62,7 @@ module OGR
|
|
60
62
|
# that will be created from the fields of the input Layer.
|
61
63
|
# @option options [String] method_prefix Set a prefix for the field names
|
62
64
|
# that will be created from the fields of the method Layer.
|
65
|
+
# @raise [OGR::Failure]
|
63
66
|
def identity(method_layer, output_layer, **options, &progress)
|
64
67
|
run_layer_method(:OGR_L_Identity, method_layer, output_layer, **options, &progress)
|
65
68
|
end
|
@@ -76,6 +79,7 @@ module OGR
|
|
76
79
|
# that will be created from the fields of the input Layer.
|
77
80
|
# @option options [String] method_prefix Set a prefix for the field names
|
78
81
|
# that will be created from the fields of the method Layer.
|
82
|
+
# @raise [OGR::Failure]
|
79
83
|
def intersection(method_layer, output_layer, **options, &progress)
|
80
84
|
run_layer_method(:OGR_L_Intersection, method_layer, output_layer, **options, &progress)
|
81
85
|
end
|
@@ -97,6 +101,7 @@ module OGR
|
|
97
101
|
# that will be created from the fields of the input Layer.
|
98
102
|
# @option options [String] method_prefix Set a prefix for the field names
|
99
103
|
# that will be created from the fields of the method Layer.
|
104
|
+
# @raise [OGR::Failure]
|
100
105
|
def symmetrical_difference(method_layer, output_layer, **options, &progress)
|
101
106
|
run_layer_method(:OGR_L_SymDifference, method_layer, output_layer, **options, &progress)
|
102
107
|
end
|
@@ -117,6 +122,7 @@ module OGR
|
|
117
122
|
# that will be created from the fields of the input Layer.
|
118
123
|
# @option options [String] method_prefix Set a prefix for the field names
|
119
124
|
# that will be created from the fields of the method Layer.
|
125
|
+
# @raise [OGR::Failure]
|
120
126
|
def union(method_layer, output_layer, **options, &progress)
|
121
127
|
run_layer_method(:OGR_L_Union, method_layer, output_layer, **options, &progress)
|
122
128
|
end
|
@@ -138,25 +144,28 @@ module OGR
|
|
138
144
|
# that will be created from the fields of the input Layer.
|
139
145
|
# @option options [String] method_prefix Set a prefix for the field names
|
140
146
|
# that will be created from the fields of the method Layer.
|
147
|
+
# @raise [OGR::Failure]
|
141
148
|
def update(method_layer, output_layer, **options, &progress)
|
142
149
|
run_layer_method(:OGR_L_Update, method_layer, output_layer, **options, &progress)
|
143
150
|
end
|
144
151
|
|
145
152
|
private
|
146
153
|
|
154
|
+
# @raise [OGR::Failure]
|
147
155
|
def run_layer_method(method_name, method_layer, output_layer, **options, &progress)
|
148
156
|
method_layer_ptr = GDAL._pointer(OGR::Layer, method_layer)
|
149
157
|
options_ptr = GDAL::Options.pointer(options)
|
150
158
|
result_layer_ptr = output_layer.c_pointer
|
151
159
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to run layer method '#{method_name}'") do
|
161
|
+
FFI::OGR::API.send(method_name,
|
162
|
+
@c_pointer,
|
163
|
+
method_layer_ptr,
|
164
|
+
result_layer_ptr,
|
165
|
+
options_ptr,
|
166
|
+
progress,
|
167
|
+
nil)
|
168
|
+
end
|
160
169
|
|
161
170
|
output_layer
|
162
171
|
end
|
@@ -23,7 +23,7 @@ module OGR
|
|
23
23
|
|
24
24
|
# Only feature which intersect the filter geometry will be returned.
|
25
25
|
#
|
26
|
-
# @param geometry_field_index [
|
26
|
+
# @param geometry_field_index [Integer] The spatial filter operates on this
|
27
27
|
# geometry field.
|
28
28
|
# @param geometry [OGR::Geometry] Use this geometry as the filtering
|
29
29
|
# region.
|
@@ -60,7 +60,7 @@ module OGR
|
|
60
60
|
# from #set_spatial_filter_rectangle). To clear the filter, set
|
61
61
|
# #spatial_filter = nil.
|
62
62
|
#
|
63
|
-
# @param geometry_field_index [
|
63
|
+
# @param geometry_field_index [Integer]
|
64
64
|
# @param min_x [Float]
|
65
65
|
# @param min_y [Float]
|
66
66
|
# @param max_x [Float]
|
@@ -82,10 +82,11 @@ module OGR
|
|
82
82
|
#
|
83
83
|
# @param query [String]
|
84
84
|
# @see http://ogdi.sourceforge.net/prop/6.2.CapabilitiesMetadata.html
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
# @raise [OGR::Failure]
|
86
|
+
def set_attribute_filter(query) # rubocop:disable Naming/AccessorMethodName
|
87
|
+
OGR::ErrorHandling.handle_ogr_err("Unable to set attribute filter: #{query}") do
|
88
|
+
FFI::OGR::API.OGR_L_SetAttributeFilter(@c_pointer, query)
|
89
|
+
end
|
89
90
|
end
|
90
91
|
end
|
91
92
|
end
|
@@ -3,17 +3,17 @@
|
|
3
3
|
module OGR
|
4
4
|
module LayerMixins
|
5
5
|
module OGRSQLMethods
|
6
|
-
# @
|
6
|
+
# @raise [OGR::Failure]
|
7
7
|
def start_transaction
|
8
8
|
transact { FFI::OGR::API.OGR_L_StartTransaction(@c_pointer) }
|
9
9
|
end
|
10
10
|
|
11
|
-
# @
|
11
|
+
# @raise [OGR::Failure]
|
12
12
|
def commit_transaction
|
13
13
|
transact { FFI::OGR::API.OGR_L_CommitTransaction(@c_pointer) }
|
14
14
|
end
|
15
15
|
|
16
|
-
# @
|
16
|
+
# @raise [OGR::Failure]
|
17
17
|
def rollback_transaction
|
18
18
|
transact { FFI::OGR::API.OGR_L_RollbackTransaction(@c_pointer) }
|
19
19
|
end
|
@@ -22,7 +22,10 @@ module OGR
|
|
22
22
|
#
|
23
23
|
# @return [String]
|
24
24
|
def fid_column
|
25
|
-
FFI::OGR::API.OGR_L_GetFIDColumn(@c_pointer)
|
25
|
+
name, ptr = FFI::OGR::API.OGR_L_GetFIDColumn(@c_pointer)
|
26
|
+
ptr.autorelease = false
|
27
|
+
|
28
|
+
name
|
26
29
|
end
|
27
30
|
|
28
31
|
# The name of the underlying database column being used as the geometry
|
@@ -30,18 +33,23 @@ module OGR
|
|
30
33
|
#
|
31
34
|
# @return [String]
|
32
35
|
def geometry_column
|
33
|
-
FFI::OGR::API.OGR_L_GetGeometryColumn(@c_pointer)
|
36
|
+
name, ptr = FFI::OGR::API.OGR_L_GetGeometryColumn(@c_pointer)
|
37
|
+
ptr.autorelease = false
|
38
|
+
|
39
|
+
name
|
34
40
|
end
|
35
41
|
|
36
42
|
private
|
37
43
|
|
38
|
-
# @
|
44
|
+
# @raise [OGR::Failure]
|
39
45
|
def transact
|
40
46
|
raise OGR::UnsupportedOperation, 'This layer does not support transactions.' unless supports_transactions?
|
41
47
|
|
42
48
|
ogr_err = yield
|
43
49
|
|
44
|
-
|
50
|
+
OGR::ErrorHandling.handle_ogr_err('Unable to set geometry directly on feature') do
|
51
|
+
ogr_err
|
52
|
+
end
|
45
53
|
end
|
46
54
|
end
|
47
55
|
end
|