ffi-gdal-extensions 0.1.1 → 0.1.2
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 +5 -5
- data/.dockerignore +7 -0
- data/.github/workflows/continuous-integration.yml +43 -0
- data/.gitignore +0 -2
- data/.rubocop.yml +6 -13
- data/.ruby-version +1 -0
- data/Changelog.md +13 -0
- data/Dockerfile.gdal2 +117 -0
- data/Dockerfile.gdal3 +78 -0
- data/Gemfile +2 -0
- data/README.md +27 -0
- data/bin/console +1 -0
- data/docker-compose.yml +26 -0
- data/ffi-gdal-extensions.gemspec +3 -1
- data/lib/ffi/gdal/extensions/version.rb +1 -1
- data/lib/ffi/lwgeom/gbox.rb +3 -0
- data/lib/ffi/lwgeom/geom.rb +1 -1
- data/lib/ffi/lwgeom.rb +49 -8
- data/lib/ogr/geometry_extensions/lwgeom_wrappers.rb +1 -1
- metadata +43 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 00af524ded28aaec66f52e19ad4d992c35e955ae314e0c431860733cff17bedd
|
4
|
+
data.tar.gz: 76678db940b288ff354019f877fe19b2499d1bb3b46a6b8740caea0500c882c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab5420e17fb7e91995c62bfabbd35b2bed86fd29919978c416582b5b9ca3d83b1bac8a180425e8e36b61c8381e259f68249fba433258a0643e4f2b76194a798
|
7
|
+
data.tar.gz: 0cdc9abac51b024360bfd669a3ba3493a8687736b8037d40917e26793722f528b8ecca676d6dc6c0832abfd4633b8bc8897f9d99d38ae09b3c82f1375e713eb9
|
data/.dockerignore
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
name: Continuous Integration
|
3
|
+
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
name: Test
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby: [2.6, 2.7, '3.0', 3.1]
|
14
|
+
runs-on: ubuntu-18.04
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Install dependencies
|
23
|
+
run: |
|
24
|
+
sudo apt-get install -y libgdal-dev liblwgeom-dev
|
25
|
+
bundle install --jobs 4 --retry 3
|
26
|
+
- name: Run tests
|
27
|
+
run: |
|
28
|
+
bundle exec rspec --format RSpec::Github::Formatter --format progress
|
29
|
+
|
30
|
+
static_analysis:
|
31
|
+
name: Rubocop
|
32
|
+
runs-on: ubuntu-18.04
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v2
|
35
|
+
- name: Set up Ruby
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: 2.6
|
39
|
+
bundler-cache: true
|
40
|
+
- name: Install dependencies
|
41
|
+
run: bundle install --jobs 4 --retry 3
|
42
|
+
- name: Rubocop
|
43
|
+
run: bundle exec rubocop --format github --parallel
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
---
|
2
|
+
require:
|
3
|
+
- rubocop-performance
|
4
|
+
|
1
5
|
Metrics/ClassLength:
|
2
6
|
Max: 300
|
3
7
|
|
@@ -7,27 +11,15 @@ Metrics/LineLength:
|
|
7
11
|
Metrics/MethodLength:
|
8
12
|
Max: 20
|
9
13
|
|
10
|
-
Style/AlignParameters:
|
11
|
-
EnforcedStyle: with_fixed_indentation
|
12
|
-
|
13
14
|
Style/Documentation:
|
14
15
|
Enabled: false
|
15
16
|
|
16
|
-
Style/DotPosition:
|
17
|
-
EnforcedStyle: trailing
|
18
|
-
|
19
17
|
Style/DoubleNegation:
|
20
18
|
Enabled: false
|
21
19
|
|
22
20
|
Style/FormatString:
|
23
21
|
EnforcedStyle: percent
|
24
22
|
|
25
|
-
Style/PercentLiteralDelimiters:
|
26
|
-
PreferredDelimiters:
|
27
|
-
'%i': '[]'
|
28
|
-
'%w': '[]'
|
29
|
-
'%W': '[]'
|
30
|
-
|
31
23
|
Style/PredicateName:
|
32
24
|
Exclude:
|
33
25
|
# Bindata has problems with srid? since srid is a parsed attribute. #z? and
|
@@ -42,8 +34,9 @@ Style/SymbolArray:
|
|
42
34
|
AllCops:
|
43
35
|
DisplayCopNames: true
|
44
36
|
DisplayStyleGuide: true
|
37
|
+
NewCops: enable
|
45
38
|
Include:
|
46
39
|
- Gemfile
|
47
40
|
Exclude:
|
48
41
|
- vendor/bundle/**/*
|
49
|
-
TargetRubyVersion: 2.
|
42
|
+
TargetRubyVersion: 2.6
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7
|
data/Changelog.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [0.1.2] - 2022-04-11
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- `lwgeom_to_wkt` and `lwgeom_to_wkb` had incorrectly wrapped the last param as a `bool`
|
12
|
+
instead of a `char`.
|
13
|
+
- `FFI::LWGeom.find_lib` now uses better logic for finding `liblwgeom`.
|
data/Dockerfile.gdal2
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# syntax=docker/dockerfile:1
|
2
|
+
FROM ruby:3.1 as base
|
3
|
+
|
4
|
+
#------------------------------------------------------------------------------
|
5
|
+
# GDAL setup
|
6
|
+
# We don't need much for ffi-gdal-extensions...
|
7
|
+
# https://trac.osgeo.org/gdal/wiki/BuildingOnUnixWithMinimizedDrivers
|
8
|
+
#------------------------------------------------------------------------------
|
9
|
+
FROM base as gdal_builder
|
10
|
+
|
11
|
+
ARG GDAL_VERSION="2.4.4"
|
12
|
+
ARG GDAL_TARBALL="gdal-${GDAL_VERSION}.tar.gz"
|
13
|
+
|
14
|
+
WORKDIR /tmp
|
15
|
+
|
16
|
+
RUN apt-get update -yqq \
|
17
|
+
&& apt-get upgrade -yqq \
|
18
|
+
&& apt-get install -yqq --no-install-recommends \
|
19
|
+
build-essential \
|
20
|
+
ca-certificates \
|
21
|
+
curl \
|
22
|
+
libgeos-dev \
|
23
|
+
&& apt-get clean \
|
24
|
+
&& rm -rf /var/lib/apt/lists/* \
|
25
|
+
&& curl -sSf -L -O "https://github.com/OSGeo/gdal/releases/download/v${GDAL_VERSION}/${GDAL_TARBALL}" \
|
26
|
+
&& curl -sSf -L -O "https://github.com/OSGeo/gdal/releases/download/v${GDAL_VERSION}/${GDAL_TARBALL}.md5" \
|
27
|
+
&& md5sum --strict --check "${GDAL_TARBALL}.md5" \
|
28
|
+
&& mkdir gdal \
|
29
|
+
&& tar -zxvf $GDAL_TARBALL -C /tmp/gdal --strip-components=1 \
|
30
|
+
&& rm ${GDAL_TARBALL} "${GDAL_TARBALL}.md5" \
|
31
|
+
&& cd /tmp/gdal \
|
32
|
+
&& ./configure \
|
33
|
+
--with-geos \
|
34
|
+
--with-geotiff=internal \
|
35
|
+
--with-libtiff=internal \
|
36
|
+
--with-libz=internal \
|
37
|
+
--with-threads \
|
38
|
+
--without-bsb \
|
39
|
+
--without-cfitsio \
|
40
|
+
--without-cryptopp \
|
41
|
+
--without-curl \
|
42
|
+
--without-ecw \
|
43
|
+
--without-expat \
|
44
|
+
--without-fme \
|
45
|
+
--without-freexl \
|
46
|
+
--without-gif \
|
47
|
+
--without-gif \
|
48
|
+
--without-gnm \
|
49
|
+
--without-grass \
|
50
|
+
--without-grib \
|
51
|
+
--without-hdf4 \
|
52
|
+
--without-hdf5 \
|
53
|
+
--without-idb \
|
54
|
+
--without-ingres \
|
55
|
+
--without-jasper \
|
56
|
+
--without-jp2mrsid \
|
57
|
+
--without-jpeg \
|
58
|
+
--without-kakadu \
|
59
|
+
--without-libgrass \
|
60
|
+
--without-libkml \
|
61
|
+
--without-libtool \
|
62
|
+
--without-mrf \
|
63
|
+
--without-mrsid \
|
64
|
+
--without-mysql \
|
65
|
+
--without-netcdf \
|
66
|
+
--without-odbc \
|
67
|
+
--without-ogdi \
|
68
|
+
--without-openjpeg \
|
69
|
+
--without-pcidsk \
|
70
|
+
--without-pcraster \
|
71
|
+
--without-pcre \
|
72
|
+
--without-perl \
|
73
|
+
--without-pg \
|
74
|
+
--without-png \
|
75
|
+
--without-python \
|
76
|
+
--without-qhull \
|
77
|
+
--without-sde \
|
78
|
+
--without-sqlite3 \
|
79
|
+
--without-webp \
|
80
|
+
--without-xerces \
|
81
|
+
--without-xml2 \
|
82
|
+
&& make \
|
83
|
+
&& make install \
|
84
|
+
&& cd /tmp \
|
85
|
+
&& rm -rf gdal
|
86
|
+
|
87
|
+
#------------------------------------------------------------------------------
|
88
|
+
# liblwgeom
|
89
|
+
#------------------------------------------------------------------------------
|
90
|
+
FROM gdal_builder as lwgeom_builder
|
91
|
+
|
92
|
+
COPY --from=liblwgeom:2.5.5-buster /usr/local/lib/liblwgeom-2.5.so.0.0.0 /usr/local/lib/
|
93
|
+
|
94
|
+
#------------------------------------------------------------------------------
|
95
|
+
# Dev setup 1
|
96
|
+
#------------------------------------------------------------------------------
|
97
|
+
FROM lwgeom_builder as dev_builder1
|
98
|
+
|
99
|
+
RUN gem update --system \
|
100
|
+
&& gem install bundler
|
101
|
+
|
102
|
+
COPY ./ffi-gdal-extensions.gemspec /usr/src/ffi-gdal-extensions/
|
103
|
+
COPY ./lib/ffi/gdal/extensions/version.rb /usr/src/ffi-gdal-extensions/lib/ffi/gdal/extensions/
|
104
|
+
COPY ./Gemfile* /usr/src/ffi-gdal-extensions/
|
105
|
+
|
106
|
+
WORKDIR /usr/src/ffi-gdal-extensions/
|
107
|
+
|
108
|
+
# Use a docker volume for storing gems
|
109
|
+
ENV BUNDLE_PATH /gems
|
110
|
+
RUN bundle install
|
111
|
+
|
112
|
+
#------------
|
113
|
+
# Copy over the rest of the lib
|
114
|
+
COPY . /usr/src/ffi-gdal-extensions/
|
115
|
+
|
116
|
+
CMD ["bundle", "exec", "rake", "spec"]
|
117
|
+
# vim:ft=dockerfile
|
data/Dockerfile.gdal3
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# syntax=docker/dockerfile:1
|
2
|
+
FROM osgeo/gdal:ubuntu-small-3.4.2 as base
|
3
|
+
|
4
|
+
#------------------------------------------------------------------------------
|
5
|
+
# liblwgeom
|
6
|
+
#------------------------------------------------------------------------------
|
7
|
+
FROM base as lwgeom_builder
|
8
|
+
|
9
|
+
COPY --from=liblwgeom:2.5.5-buster /usr/local/lib/liblwgeom-2.5.so.0.0.0 /usr/local/lib/
|
10
|
+
|
11
|
+
#------------------------------------------------------------------------------
|
12
|
+
# Dev setup 1
|
13
|
+
#------------------------------------------------------------------------------
|
14
|
+
FROM lwgeom_builder as ruby_builder
|
15
|
+
|
16
|
+
RUN apt-get update -yqq \
|
17
|
+
&& apt-get install -yqq --no-install-recommends \
|
18
|
+
build-essential \
|
19
|
+
libgeos-dev \
|
20
|
+
libproj-dev \
|
21
|
+
libyaml-dev \
|
22
|
+
&& apt-get clean \
|
23
|
+
&& rm -rf /var/lib/apt/lists/*
|
24
|
+
|
25
|
+
ENV GEM_HOME /usr/local/bundle
|
26
|
+
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
|
27
|
+
BUNDLE_APP_CONFIG="$GEM_HOME"
|
28
|
+
ENV PATH $GEM_HOME/bin:$PATH
|
29
|
+
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
|
30
|
+
|
31
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/bin/* /usr/local/bin/
|
32
|
+
|
33
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/lib/libruby.so.3.1.1 /usr/local/lib/
|
34
|
+
RUN ln -s /usr/local/lib/libruby.so.3.1.1 /usr/local/lib/libruby.so
|
35
|
+
|
36
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/lib/pkgconfig/ruby-3.1.pc /usr/local/lib/pkgconfig/
|
37
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/lib/ruby/3.1.0 /usr/local/lib/ruby/3.1.0
|
38
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/lib/ruby/gems /usr/local/lib/ruby/gems
|
39
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/lib/ruby/site_ruby /usr/local/lib/ruby/site_ruby
|
40
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/lib/ruby/vendor_ruby /usr/local/lib/ruby/vendor_ruby
|
41
|
+
|
42
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/include/ruby-3.1.0 /usr/local/include/ruby-3.1.0
|
43
|
+
|
44
|
+
COPY --from=ruby:3.1 --chown=root /usr/local/etc/gemrc /usr/local/etc/gemrc
|
45
|
+
|
46
|
+
# Link the libraries after copying them over from the ruby image.
|
47
|
+
RUN ldconfig
|
48
|
+
|
49
|
+
RUN gem update --system \
|
50
|
+
&& gem install bundler
|
51
|
+
|
52
|
+
#------------------------------------------------------------------------------
|
53
|
+
# Dev setup 1
|
54
|
+
#------------------------------------------------------------------------------
|
55
|
+
FROM ruby_builder as dev_builder1
|
56
|
+
|
57
|
+
RUN apt-get update -yqq \
|
58
|
+
&& apt-get install -yqq --no-install-recommends \
|
59
|
+
git \
|
60
|
+
&& apt-get clean \
|
61
|
+
&& rm -rf /var/lib/apt/lists/*
|
62
|
+
|
63
|
+
COPY ./ffi-gdal-extensions.gemspec /usr/src/ffi-gdal-extensions/
|
64
|
+
COPY ./lib/ffi/gdal/extensions/version.rb /usr/src/ffi-gdal-extensions/lib/ffi/gdal/extensions/
|
65
|
+
COPY ./Gemfile* /usr/src/ffi-gdal-extensions/
|
66
|
+
|
67
|
+
WORKDIR /usr/src/ffi-gdal-extensions/
|
68
|
+
|
69
|
+
# Use a docker volume for storing gems
|
70
|
+
ENV BUNDLE_PATH /gems
|
71
|
+
RUN bundle install
|
72
|
+
|
73
|
+
#------------
|
74
|
+
# Copy over the rest of the lib
|
75
|
+
COPY . /usr/src/ffi-gdal-extensions/
|
76
|
+
|
77
|
+
CMD ["bundle", "exec", "rake", "spec"]
|
78
|
+
# vim:ft=dockerfile
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,33 @@ release a new version, update the version number in `version.rb`, and then run
|
|
37
37
|
git commits and tags, and push the `.gem` file to
|
38
38
|
[rubygems.org](https://rubygems.org).
|
39
39
|
|
40
|
+
### Development Using Docker
|
41
|
+
|
42
|
+
The `docker-compose.yml` file provides two configurations for running tests
|
43
|
+
against:
|
44
|
+
|
45
|
+
- `Dockerfile.gdal3`
|
46
|
+
- GDAL 3.4.2
|
47
|
+
- `liblwgeom` 2.5.5
|
48
|
+
- Ruby 3.1.1
|
49
|
+
- `Dockerfile.gdal2`
|
50
|
+
- GDAL 2.4.4
|
51
|
+
- `liblwgeom` 2.5.5
|
52
|
+
- Ruby 3.1.1
|
53
|
+
|
54
|
+
Running tests looks something like:
|
55
|
+
|
56
|
+
...for GDAL3:
|
57
|
+
|
58
|
+
```
|
59
|
+
docker-compose run gdal3 bundle exec rake spec
|
60
|
+
```
|
61
|
+
|
62
|
+
...for GDAL2:
|
63
|
+
|
64
|
+
```
|
65
|
+
docker-compose run gdal2 bundle exec rake spec
|
66
|
+
```
|
40
67
|
## Contributing
|
41
68
|
|
42
69
|
Bug reports and pull requests are welcome on BitBucket at
|
data/bin/console
CHANGED
data/docker-compose.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
version: "3"
|
3
|
+
|
4
|
+
services:
|
5
|
+
gdal2:
|
6
|
+
build:
|
7
|
+
context: .
|
8
|
+
args:
|
9
|
+
GDAL_VERSION: "2.4.4"
|
10
|
+
dockerfile: Dockerfile.gdal2
|
11
|
+
volumes:
|
12
|
+
- .:/usr/src/ffi-gdal-extensions
|
13
|
+
- gem_cache:/gems
|
14
|
+
|
15
|
+
gdal3:
|
16
|
+
build:
|
17
|
+
context: .
|
18
|
+
args:
|
19
|
+
GDAL_VERSION: "3.4.2"
|
20
|
+
dockerfile: Dockerfile.gdal3
|
21
|
+
volumes:
|
22
|
+
- .:/usr/src/ffi-gdal-extensions
|
23
|
+
- gem_cache:/gems
|
24
|
+
|
25
|
+
volumes:
|
26
|
+
gem_cache:
|
data/ffi-gdal-extensions.gemspec
CHANGED
@@ -24,9 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency 'bindata', '~> 2.0'
|
25
25
|
spec.add_dependency 'ffi-gdal', '>= 1.0.0.beta6'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler', '~>
|
27
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
28
28
|
spec.add_development_dependency 'byebug'
|
29
29
|
spec.add_development_dependency 'rake'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
|
+
spec.add_development_dependency 'rspec-github'
|
31
32
|
spec.add_development_dependency 'rubocop'
|
33
|
+
spec.add_development_dependency 'rubocop-performance'
|
32
34
|
end
|
data/lib/ffi/lwgeom/gbox.rb
CHANGED
data/lib/ffi/lwgeom/geom.rb
CHANGED
data/lib/ffi/lwgeom.rb
CHANGED
@@ -10,20 +10,48 @@ module FFI
|
|
10
10
|
def self.find_lib(lib)
|
11
11
|
lib_file_name = "#{lib}.#{FFI::Platform::LIBSUFFIX}*"
|
12
12
|
|
13
|
-
if ENV['LWGEOM_LIBRARY_PATH']
|
14
|
-
|
13
|
+
if (lwgeom_library_path = ENV['LWGEOM_LIBRARY_PATH'])
|
14
|
+
if File.exist?(lwgeom_library_path) && File.file?(lwgeom_library_path)
|
15
|
+
return lwgeom_library_path
|
16
|
+
end
|
17
|
+
|
18
|
+
result = Dir[File.join(lwgeom_library_path, lib_file_name)].compact
|
19
|
+
|
20
|
+
if (f = result.first)
|
21
|
+
return f
|
22
|
+
end
|
23
|
+
|
24
|
+
raise "library '#{lib}' not found"
|
15
25
|
end
|
16
26
|
|
17
|
-
|
18
|
-
Dir.glob(search_path).
|
27
|
+
search_paths.map do |search_path|
|
28
|
+
Dir.glob(search_path).map do |path|
|
19
29
|
Dir.glob(File.join(path, lib_file_name))
|
20
30
|
end
|
21
|
-
end.uniq.first
|
31
|
+
end.flatten.uniq.first
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [Array<String>] List of paths to search for libs in.
|
35
|
+
def self.search_paths
|
36
|
+
return [ENV['LWGEOM_LIBRARY_PATH']] if ENV['LWGEOM_LIBRARY_PATH']
|
37
|
+
|
38
|
+
@search_paths ||= begin
|
39
|
+
paths = ENV['PATH'].split(File::PATH_SEPARATOR)
|
40
|
+
|
41
|
+
unless FFI::Platform.windows?
|
42
|
+
paths += %w[/usr/local/{lib64,lib} /opt/local/{lib64,lib} /usr/{lib64,lib} /usr/lib/{x86_64,i386}-linux-gnu]
|
43
|
+
end
|
44
|
+
|
45
|
+
paths
|
46
|
+
end
|
22
47
|
end
|
23
48
|
|
24
|
-
LIB_PATH = find_lib('liblwgeom').freeze
|
49
|
+
LIB_PATH = find_lib('liblwgeom*').freeze
|
25
50
|
ffi_lib [::FFI::CURRENT_PROCESS, LIB_PATH] if LIB_PATH
|
26
51
|
|
52
|
+
# In PostGIS <=2.5.5, this is a u8; in >=3.x, this is a u16.
|
53
|
+
typedef :uint8, :lwflags_t
|
54
|
+
|
27
55
|
VARIANT_WKB_ISO = 0x01
|
28
56
|
VARIANT_WKB_SFSQL = 0x02
|
29
57
|
VARIANT_WKB_EXTENDED = 0x04
|
@@ -35,8 +63,21 @@ module FFI
|
|
35
63
|
VARIANT_WKT_SFSQL = 0x02
|
36
64
|
VARIANT_WKT_EXTENDED = 0x04
|
37
65
|
|
38
|
-
|
39
|
-
|
66
|
+
LW_PARSER_CHECK_NONE = 0
|
67
|
+
LW_PARSER_CHECK_MINPOINTS = 1
|
68
|
+
LW_PARSER_CHECK_ODD = 2
|
69
|
+
LW_PARSER_CHECK_CLOSURE = 4
|
70
|
+
LW_PARSER_CHECK_ZCLOSURE = 8
|
71
|
+
|
72
|
+
# The `:char` param is a bitmask based on the `LW_PARSER_CHECK_` flags.
|
73
|
+
attach_function :lwgeom_from_wkt, %i[string char], Geom.ptr
|
74
|
+
|
75
|
+
# The `:char` param is a bitmask based on the `LW_PARSER_CHECK_` flags.
|
76
|
+
attach_function :lwgeom_from_wkb, %i[pointer size_t char], Geom.ptr
|
77
|
+
|
78
|
+
# The `:uint8` param is the geometry variant flag, given by `VARIANT_WKT_*`.
|
79
|
+
# The `:int` param is the precision.
|
80
|
+
# The `:pointer` is an out param that will contain the size of the buffer.
|
40
81
|
attach_function :lwgeom_to_wkt, [Geom.ptr, :uint8, :int, :pointer], :string
|
41
82
|
attach_function :lwgeom_to_wkb, [Geom.ptr, :uint8, :pointer], :pointer
|
42
83
|
|
@@ -13,7 +13,7 @@ module OGR
|
|
13
13
|
# @return [OGR::Geometry] Returns a new geometry, based on the
|
14
14
|
# lwgeom_make_valid call.
|
15
15
|
def make_valid
|
16
|
-
geom = FFI::LWGeom.lwgeom_from_wkb(to_wkb, wkb_size,
|
16
|
+
geom = FFI::LWGeom.lwgeom_from_wkb(to_wkb, wkb_size, FFI::LWGeom::LW_PARSER_CHECK_NONE)
|
17
17
|
valid_geom = FFI::LWGeom.lwgeom_make_valid(geom)
|
18
18
|
valid_wkb_size = FFI::MemoryPointer.new(:size_t)
|
19
19
|
valid_wkb_ptr = FFI::LWGeom.lwgeom_to_wkb(valid_geom, FFI::LWGeom::VARIANT_WKB_EXTENDED, valid_wkb_size)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-gdal-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Loveless
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: byebug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-github
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rubocop
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-performance
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
description: |-
|
112
140
|
Make ffi-gdal feel more like Ruby, plus adds some new
|
113
141
|
functionality
|
@@ -117,17 +145,24 @@ executables: []
|
|
117
145
|
extensions: []
|
118
146
|
extra_rdoc_files: []
|
119
147
|
files:
|
148
|
+
- ".dockerignore"
|
149
|
+
- ".github/workflows/continuous-integration.yml"
|
120
150
|
- ".gitignore"
|
121
151
|
- ".rspec"
|
122
152
|
- ".rubocop.yml"
|
153
|
+
- ".ruby-version"
|
123
154
|
- ".travis.yml"
|
124
155
|
- CODE_OF_CONDUCT.md
|
156
|
+
- Changelog.md
|
157
|
+
- Dockerfile.gdal2
|
158
|
+
- Dockerfile.gdal3
|
125
159
|
- Gemfile
|
126
160
|
- History.md
|
127
161
|
- README.md
|
128
162
|
- Rakefile
|
129
163
|
- bin/console
|
130
164
|
- bin/setup
|
165
|
+
- docker-compose.yml
|
131
166
|
- ffi-gdal-extensions.gemspec
|
132
167
|
- lib/ffi/gdal/extensions.rb
|
133
168
|
- lib/ffi/gdal/extensions/version.rb
|
@@ -141,7 +176,7 @@ files:
|
|
141
176
|
homepage: https://bitbucket.org/agrian/ffi-gdal-extensions
|
142
177
|
licenses: []
|
143
178
|
metadata: {}
|
144
|
-
post_install_message:
|
179
|
+
post_install_message:
|
145
180
|
rdoc_options: []
|
146
181
|
require_paths:
|
147
182
|
- lib
|
@@ -156,9 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
191
|
- !ruby/object:Gem::Version
|
157
192
|
version: '0'
|
158
193
|
requirements: []
|
159
|
-
|
160
|
-
|
161
|
-
signing_key:
|
194
|
+
rubygems_version: 3.1.6
|
195
|
+
signing_key:
|
162
196
|
specification_version: 4
|
163
197
|
summary: Additional functionality to the ffi-gdal gem
|
164
198
|
test_files: []
|