rgeo 2.3.1 → 3.0.0.pre.rc.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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -0
  3. data/README.md +11 -10
  4. data/ext/geos_c_impl/analysis.c +8 -6
  5. data/ext/geos_c_impl/analysis.h +1 -3
  6. data/ext/geos_c_impl/errors.c +10 -8
  7. data/ext/geos_c_impl/errors.h +7 -3
  8. data/ext/geos_c_impl/extconf.rb +3 -0
  9. data/ext/geos_c_impl/factory.c +273 -202
  10. data/ext/geos_c_impl/factory.h +51 -63
  11. data/ext/geos_c_impl/geometry.c +124 -22
  12. data/ext/geos_c_impl/geometry.h +8 -3
  13. data/ext/geos_c_impl/geometry_collection.c +81 -185
  14. data/ext/geos_c_impl/geometry_collection.h +1 -14
  15. data/ext/geos_c_impl/globals.c +91 -0
  16. data/ext/geos_c_impl/globals.h +45 -0
  17. data/ext/geos_c_impl/line_string.c +28 -29
  18. data/ext/geos_c_impl/line_string.h +1 -3
  19. data/ext/geos_c_impl/main.c +10 -9
  20. data/ext/geos_c_impl/point.c +9 -8
  21. data/ext/geos_c_impl/point.h +1 -3
  22. data/ext/geos_c_impl/polygon.c +43 -72
  23. data/ext/geos_c_impl/polygon.h +1 -3
  24. data/ext/geos_c_impl/preface.h +12 -0
  25. data/ext/geos_c_impl/ruby_more.c +65 -0
  26. data/ext/geos_c_impl/ruby_more.h +16 -0
  27. data/lib/rgeo/cartesian/calculations.rb +54 -17
  28. data/lib/rgeo/cartesian/factory.rb +6 -14
  29. data/lib/rgeo/cartesian/feature_classes.rb +68 -46
  30. data/lib/rgeo/cartesian/feature_methods.rb +67 -20
  31. data/lib/rgeo/cartesian/interface.rb +0 -36
  32. data/lib/rgeo/cartesian/planar_graph.rb +379 -0
  33. data/lib/rgeo/cartesian/sweepline_intersector.rb +149 -0
  34. data/lib/rgeo/cartesian/valid_op.rb +71 -0
  35. data/lib/rgeo/cartesian.rb +3 -0
  36. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +6 -6
  37. data/lib/rgeo/coord_sys.rb +0 -11
  38. data/lib/rgeo/error.rb +15 -0
  39. data/lib/rgeo/feature/factory_generator.rb +0 -3
  40. data/lib/rgeo/feature/geometry.rb +107 -28
  41. data/lib/rgeo/feature/geometry_collection.rb +13 -5
  42. data/lib/rgeo/feature/line_string.rb +3 -3
  43. data/lib/rgeo/feature/multi_surface.rb +3 -3
  44. data/lib/rgeo/feature/point.rb +4 -4
  45. data/lib/rgeo/feature/surface.rb +3 -3
  46. data/lib/rgeo/geographic/factory.rb +6 -7
  47. data/lib/rgeo/geographic/interface.rb +6 -49
  48. data/lib/rgeo/geographic/proj4_projector.rb +0 -2
  49. data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
  50. data/lib/rgeo/geographic/projected_feature_methods.rb +67 -28
  51. data/lib/rgeo/geographic/simple_mercator_projector.rb +0 -2
  52. data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
  53. data/lib/rgeo/geographic/spherical_feature_methods.rb +79 -2
  54. data/lib/rgeo/geos/capi_factory.rb +21 -38
  55. data/lib/rgeo/geos/capi_feature_classes.rb +54 -11
  56. data/lib/rgeo/geos/ffi_factory.rb +6 -35
  57. data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
  58. data/lib/rgeo/geos/ffi_feature_methods.rb +39 -5
  59. data/lib/rgeo/geos/interface.rb +0 -24
  60. data/lib/rgeo/geos/zm_factory.rb +0 -19
  61. data/lib/rgeo/geos/zm_feature_methods.rb +16 -0
  62. data/lib/rgeo/geos.rb +6 -3
  63. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +4 -4
  64. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -1
  65. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +15 -19
  66. data/lib/rgeo/impl_helper/basic_point_methods.rb +1 -1
  67. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +1 -1
  68. data/lib/rgeo/impl_helper/valid_op.rb +354 -0
  69. data/lib/rgeo/impl_helper/validity_check.rb +139 -0
  70. data/lib/rgeo/impl_helper.rb +1 -0
  71. data/lib/rgeo/version.rb +1 -1
  72. metadata +45 -9
  73. data/lib/rgeo/coord_sys/srs_database/entry.rb +0 -107
  74. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +0 -64
  75. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +0 -65
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 3.0.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-30 00:00:00.000000000 Z
12
+ date: 2022-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi-geos
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.2'
20
+ version: '2.2'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.2'
27
+ version: '2.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: minitest
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +81,34 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: 1.8.1
84
+ - !ruby/object:Gem::Dependency
85
+ name: ruby_memcheck
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '1.0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '1.0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: yard
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.9'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.9'
84
112
  description: RGeo is a geospatial data library for Ruby. It provides an implementation
85
113
  of the Open Geospatial Consortium's Simple Features Specification, used by most
86
114
  standard spatial/geographic data storage systems such as PostGIS. A number of add-on
@@ -90,11 +118,13 @@ email:
90
118
  - dazuma@gmail.com
91
119
  - parhameter@gmail.com
92
120
  - kfdoggett@gmail.com
121
+ - buonomo.ulysse@gmail.com
93
122
  executables: []
94
123
  extensions:
95
124
  - ext/geos_c_impl/extconf.rb
96
125
  extra_rdoc_files: []
97
126
  files:
127
+ - ".yardopts"
98
128
  - LICENSE.txt
99
129
  - README.md
100
130
  - ext/geos_c_impl/analysis.c
@@ -110,6 +140,8 @@ files:
110
140
  - ext/geos_c_impl/geometry.h
111
141
  - ext/geos_c_impl/geometry_collection.c
112
142
  - ext/geos_c_impl/geometry_collection.h
143
+ - ext/geos_c_impl/globals.c
144
+ - ext/geos_c_impl/globals.h
113
145
  - ext/geos_c_impl/line_string.c
114
146
  - ext/geos_c_impl/line_string.h
115
147
  - ext/geos_c_impl/main.c
@@ -118,6 +150,8 @@ files:
118
150
  - ext/geos_c_impl/polygon.c
119
151
  - ext/geos_c_impl/polygon.h
120
152
  - ext/geos_c_impl/preface.h
153
+ - ext/geos_c_impl/ruby_more.c
154
+ - ext/geos_c_impl/ruby_more.h
121
155
  - lib/rgeo.rb
122
156
  - lib/rgeo/cartesian.rb
123
157
  - lib/rgeo/cartesian/analysis.rb
@@ -127,13 +161,13 @@ files:
127
161
  - lib/rgeo/cartesian/feature_classes.rb
128
162
  - lib/rgeo/cartesian/feature_methods.rb
129
163
  - lib/rgeo/cartesian/interface.rb
164
+ - lib/rgeo/cartesian/planar_graph.rb
165
+ - lib/rgeo/cartesian/sweepline_intersector.rb
166
+ - lib/rgeo/cartesian/valid_op.rb
130
167
  - lib/rgeo/coord_sys.rb
131
168
  - lib/rgeo/coord_sys/cs/entities.rb
132
169
  - lib/rgeo/coord_sys/cs/factories.rb
133
170
  - lib/rgeo/coord_sys/cs/wkt_parser.rb
134
- - lib/rgeo/coord_sys/srs_database/entry.rb
135
- - lib/rgeo/coord_sys/srs_database/sr_org.rb
136
- - lib/rgeo/coord_sys/srs_database/url_reader.rb
137
171
  - lib/rgeo/error.rb
138
172
  - lib/rgeo/feature.rb
139
173
  - lib/rgeo/feature/curve.rb
@@ -183,6 +217,8 @@ files:
183
217
  - lib/rgeo/impl_helper/basic_polygon_methods.rb
184
218
  - lib/rgeo/impl_helper/math.rb
185
219
  - lib/rgeo/impl_helper/utils.rb
220
+ - lib/rgeo/impl_helper/valid_op.rb
221
+ - lib/rgeo/impl_helper/validity_check.rb
186
222
  - lib/rgeo/version.rb
187
223
  - lib/rgeo/wkrep.rb
188
224
  - lib/rgeo/wkrep/wkb_generator.rb
@@ -204,9 +240,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
240
  version: 2.5.0
205
241
  required_rubygems_version: !ruby/object:Gem::Requirement
206
242
  requirements:
207
- - - ">="
243
+ - - ">"
208
244
  - !ruby/object:Gem::Version
209
- version: '0'
245
+ version: 1.3.1
210
246
  requirements: []
211
247
  rubygems_version: 3.1.4
212
248
  signing_key:
@@ -1,107 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # -----------------------------------------------------------------------------
4
- #
5
- # SRS database interface
6
- #
7
- # -----------------------------------------------------------------------------
8
-
9
- module RGeo
10
- module CoordSys
11
- # This module contains tools for accessing spatial reference
12
- # databases. These are databases (either local or remote) from which
13
- # you can look up coordinate system specifications, typically in
14
- # either OGC or Proj4 format. For example, you can access the
15
- # <tt>spatial_ref_sys</tt> table provided with an OGC-compliant RDBMS
16
- # such as PostGIS. You can also read the database files provided with
17
- # the proj4 library, or access online databases such as the
18
- # spatialreference.org site.
19
-
20
- # Spatial reference system database classes must implement these methods:
21
- # get
22
- # clear_cache
23
- #
24
- # See SrOrg and UrlReader for implementations of SRSDatabase classes.
25
- #
26
- # Retrieve an Entry given an identifier. The identifier is usually
27
- # a numeric spatial reference ID (SRID), but could be a string
28
- # value for certain database types.
29
- # get(identifier)
30
- #
31
- # Clear any cache utilized by this database.
32
- # clear_cache
33
-
34
- module SRSDatabase
35
- # An entry in a spatial reference system database.
36
- # Every entry has an identifier, but all the other attributes are
37
- # optional and may or may not be present depending on the database.
38
- class Entry
39
- # Create an entry.
40
- # You must provide an identifier, which may be numeric or a
41
- # string. The data hash should contain any other attributes,
42
- # keyed by symbol.
43
- #
44
- # Some attribute inputs have special behaviors:
45
- #
46
- # [<tt>:coord_sys</tt>]
47
- # You can pass a CS coordinate system object, or a string in
48
- # WKT format.
49
- # [<tt>:proj4</tt>]
50
- # You can pass a Proj4 object, or a proj4-format string.
51
- # [<tt>:name</tt>]
52
- # If the name is not provided directly, it is taken from the
53
- # coord_sys.
54
- # [<tt>:authority</tt>]
55
- # If the authority name is not provided directly, it is taken
56
- # from the coord_sys.
57
- # [<tt>:authority_code</tt>]
58
- # If the authority code is not provided directly, it is taken
59
- # from the coord_sys.
60
-
61
- def initialize(ident, data = {})
62
- @identifier = ident
63
- @authority = data[:authority]
64
- @authority_code = data[:authority_code]
65
- @name = data[:name]
66
- @description = data[:description]
67
- @coord_sys = data[:coord_sys]
68
- if @coord_sys.is_a?(String)
69
- @coord_sys = CS.create_from_wkt(@coord_sys)
70
- end
71
- @proj4 = data[:proj4]
72
- if @proj4 && CoordSys.check!(:proj4)
73
- if @proj4.is_a?(String) || @proj4.is_a?(Hash)
74
- @proj4 = Proj4.create(@proj4)
75
- end
76
- end
77
- if @coord_sys
78
- @name = @coord_sys.name unless @name
79
- @authority = @coord_sys.authority unless @authority
80
- @authority_code = @coord_sys.authority unless @authority_code
81
- end
82
- end
83
-
84
- # The database key or identifier.
85
- attr_reader :identifier
86
-
87
- # The authority name, if present. Example: "epsg".
88
- attr_reader :authority
89
-
90
- # The authority code, e.g. an EPSG code.
91
- attr_reader :authority_code
92
-
93
- # A human-readable name for this coordinate system.
94
- attr_reader :name
95
-
96
- # A human-readable description for this coordinate system.
97
- attr_reader :description
98
-
99
- # The CS::CoordinateSystem object.
100
- attr_reader :coord_sys
101
-
102
- # The Proj4 object.
103
- attr_reader :proj4
104
- end
105
- end
106
- end
107
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # -----------------------------------------------------------------------------
4
- #
5
- # SRS database interface
6
- #
7
- # -----------------------------------------------------------------------------
8
-
9
- require "net/http"
10
-
11
- module RGeo
12
- module CoordSys
13
- module SRSDatabase
14
- # A spatial reference database implementation that fetches data
15
- # from the spatialreference.org website.
16
-
17
- class SrOrg
18
- # Create a database backed by the given catalog of the
19
- # spatialreference.org website. Catalogs currently supported by
20
- # spatialreference.org are "epsg", "esri", "iau2000" and "sr-org".
21
- #
22
- # Options:
23
- #
24
- # [<tt>:cache</tt>]
25
- # If set to true, lookup results are cached so if the same URL
26
- # is requested again, the result is served from cache rather
27
- # than issuing another HTTP request. Default is false.
28
-
29
- def initialize(catalog, opts = {})
30
- @catalog = catalog.to_s.downcase
31
- @cache = opts[:cache] ? {} : nil
32
- end
33
-
34
- # The spatialreference.org catalog used by this database.
35
- attr_reader :catalog
36
-
37
- # Retrieve the Entry from a spatialreference.org catalog given an
38
- # integer ID.
39
-
40
- def get(ident)
41
- ident = ident.to_s
42
- return @cache[ident] if @cache&.include?(ident)
43
- coord_sys = nil
44
- proj4 = nil
45
- Net::HTTP.start("spatialreference.org") do |http|
46
- response = http.request_get("/ref/#{@catalog}/#{ident}/ogcwkt/")
47
- coord_sys = response.body if response.is_a?(Net::HTTPSuccess)
48
- response = http.request_get("/ref/#{@catalog}/#{ident}/proj4/")
49
- proj4 = response.body if response.is_a?(Net::HTTPSuccess)
50
- end
51
- result = Entry.new(ident, coord_sys: coord_sys.strip, proj4: proj4.strip)
52
- @cache[ident] = result if @cache
53
- result
54
- end
55
-
56
- # Clear the cache if one exists.
57
-
58
- def clear_cache
59
- @cache&.clear
60
- end
61
- end
62
- end
63
- end
64
- end
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # -----------------------------------------------------------------------------
4
- #
5
- # SRS database interface
6
- #
7
- # -----------------------------------------------------------------------------
8
-
9
- require "net/http"
10
-
11
- module RGeo
12
- module CoordSys
13
- module SRSDatabase
14
- # A spatial reference database implementation that fetches data from
15
- # internet URLs.
16
-
17
- class UrlReader
18
- # Create a URL-based spatial reference database.
19
- #
20
- # Options:
21
- #
22
- # [<tt>:cache</tt>]
23
- # If set to true, lookup results are cached so if the same URL
24
- # is requested again, the result is served from cache rather
25
- # than issuing another HTTP request. Default is false.
26
-
27
- def initialize(opts = {})
28
- @cache = opts[:cache] ? {} : nil
29
- end
30
-
31
- # Retrieve the given URL and return an Entry.
32
- # Returns nil if the URL cannot be read as an OGC WKT or Proj4
33
- # coordinate system
34
-
35
- def get(ident)
36
- ident = ident.to_s
37
- return @cache[ident] if @cache&.include?(ident)
38
- uri = URI.parse(ident)
39
- result = nil
40
- Net::HTTP.start(uri.host, uri.port) do |http|
41
- request = uri.path
42
- request = "#{request}?#{uri.query}" if uri.query
43
- response = http.requestget(request)
44
- if response.is_a?(Net::HTTPSuccess)
45
- response = response.body.strip
46
- if response[0, 1] == "+"
47
- result = Entry.new(ident, proj4: response)
48
- else
49
- result = Entry.new(ident, coord_sys: response)
50
- end
51
- end
52
- end
53
- @cache[ident] = result if @cache
54
- result
55
- end
56
-
57
- # Clear the cache if one is present.
58
-
59
- def clear_cache
60
- @cache&.clear
61
- end
62
- end
63
- end
64
- end
65
- end