rgeo 2.3.1 → 3.0.0.pre.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +6 -0
- data/README.md +11 -10
- data/ext/geos_c_impl/analysis.c +8 -6
- data/ext/geos_c_impl/analysis.h +1 -3
- data/ext/geos_c_impl/errors.c +10 -8
- data/ext/geos_c_impl/errors.h +7 -3
- data/ext/geos_c_impl/extconf.rb +3 -0
- data/ext/geos_c_impl/factory.c +273 -202
- data/ext/geos_c_impl/factory.h +51 -63
- data/ext/geos_c_impl/geometry.c +124 -22
- data/ext/geos_c_impl/geometry.h +8 -3
- data/ext/geos_c_impl/geometry_collection.c +81 -185
- data/ext/geos_c_impl/geometry_collection.h +1 -14
- data/ext/geos_c_impl/globals.c +91 -0
- data/ext/geos_c_impl/globals.h +45 -0
- data/ext/geos_c_impl/line_string.c +28 -29
- data/ext/geos_c_impl/line_string.h +1 -3
- data/ext/geos_c_impl/main.c +10 -9
- data/ext/geos_c_impl/point.c +9 -8
- data/ext/geos_c_impl/point.h +1 -3
- data/ext/geos_c_impl/polygon.c +43 -72
- data/ext/geos_c_impl/polygon.h +1 -3
- data/ext/geos_c_impl/preface.h +12 -0
- data/ext/geos_c_impl/ruby_more.c +65 -0
- data/ext/geos_c_impl/ruby_more.h +16 -0
- data/lib/rgeo/cartesian/calculations.rb +54 -17
- data/lib/rgeo/cartesian/factory.rb +6 -14
- data/lib/rgeo/cartesian/feature_classes.rb +68 -46
- data/lib/rgeo/cartesian/feature_methods.rb +67 -20
- data/lib/rgeo/cartesian/interface.rb +0 -36
- data/lib/rgeo/cartesian/planar_graph.rb +379 -0
- data/lib/rgeo/cartesian/sweepline_intersector.rb +149 -0
- data/lib/rgeo/cartesian/valid_op.rb +71 -0
- data/lib/rgeo/cartesian.rb +3 -0
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +6 -6
- data/lib/rgeo/coord_sys.rb +0 -11
- data/lib/rgeo/error.rb +15 -0
- data/lib/rgeo/feature/factory_generator.rb +0 -3
- data/lib/rgeo/feature/geometry.rb +107 -28
- data/lib/rgeo/feature/geometry_collection.rb +13 -5
- data/lib/rgeo/feature/line_string.rb +3 -3
- data/lib/rgeo/feature/multi_surface.rb +3 -3
- data/lib/rgeo/feature/point.rb +4 -4
- data/lib/rgeo/feature/surface.rb +3 -3
- data/lib/rgeo/geographic/factory.rb +6 -7
- data/lib/rgeo/geographic/interface.rb +6 -49
- data/lib/rgeo/geographic/proj4_projector.rb +0 -2
- data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
- data/lib/rgeo/geographic/projected_feature_methods.rb +67 -28
- data/lib/rgeo/geographic/simple_mercator_projector.rb +0 -2
- data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
- data/lib/rgeo/geographic/spherical_feature_methods.rb +79 -2
- data/lib/rgeo/geos/capi_factory.rb +21 -38
- data/lib/rgeo/geos/capi_feature_classes.rb +54 -11
- data/lib/rgeo/geos/ffi_factory.rb +6 -35
- data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
- data/lib/rgeo/geos/ffi_feature_methods.rb +39 -5
- data/lib/rgeo/geos/interface.rb +0 -24
- data/lib/rgeo/geos/zm_factory.rb +0 -19
- data/lib/rgeo/geos/zm_feature_methods.rb +16 -0
- data/lib/rgeo/geos.rb +6 -3
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +4 -4
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -1
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +15 -19
- data/lib/rgeo/impl_helper/basic_point_methods.rb +1 -1
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +1 -1
- data/lib/rgeo/impl_helper/valid_op.rb +354 -0
- data/lib/rgeo/impl_helper/validity_check.rb +139 -0
- data/lib/rgeo/impl_helper.rb +1 -0
- data/lib/rgeo/version.rb +1 -1
- metadata +45 -9
- data/lib/rgeo/coord_sys/srs_database/entry.rb +0 -107
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +0 -64
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +0 -65
data/lib/rgeo/error.rb
CHANGED
@@ -29,5 +29,20 @@ module RGeo
|
|
29
29
|
# Parsing failed
|
30
30
|
class ParseError < RGeoError
|
31
31
|
end
|
32
|
+
|
33
|
+
# Standard error messages from
|
34
|
+
# https://github.com/locationtech/jts/blob/0afbfb1956ec24912a8b4dc4edff0f1200442857/modules/core/src/main/java/org/locationtech/jts/operation/valid/TopologyValidationError.java#L98-L110
|
35
|
+
TOPOLOGY_VALIDATION_ERR = "Topology Validation Error"
|
36
|
+
REPEATED_POINT = "Repeated Point"
|
37
|
+
HOLE_OUTSIDE_SHELL = "Hole lies outside shell"
|
38
|
+
NESTED_HOLES = "Holes are nested"
|
39
|
+
DISCONNECTED_INTERIOR = "Interior is disconnected"
|
40
|
+
SELF_INTERSECTION = "Self-intersection"
|
41
|
+
RING_SELF_INTERSECTION = "Ring Self-intersection"
|
42
|
+
NESTED_SHELLS = "Nested shells"
|
43
|
+
DUPLICATE_RINGS = "Duplicate Rings"
|
44
|
+
TOO_FEW_POINTS = "Too few distinct points in geometry component"
|
45
|
+
INVALID_COORDINATE = "Invalid Coordinate"
|
46
|
+
UNCLOSED_RING = "Ring is not closed"
|
32
47
|
end
|
33
48
|
end
|
@@ -66,9 +66,6 @@ module RGeo
|
|
66
66
|
# CoordSys::CS::CoordinateSystem, or as a string in WKT format.
|
67
67
|
# This is usually an optional parameter; the default is usually
|
68
68
|
# nil.
|
69
|
-
# [<tt>:srs_database</tt>]
|
70
|
-
# If provided, look up the Proj4 and OGC coordinate systems from
|
71
|
-
# the given database and SRID.
|
72
69
|
# [<tt>:has_z_coordinate</tt>]
|
73
70
|
# Support Z coordinates. Default is usually false.
|
74
71
|
# [<tt>:has_m_coordinate</tt>]
|
@@ -90,7 +90,7 @@ module RGeo
|
|
90
90
|
# operations on them.)
|
91
91
|
|
92
92
|
def factory
|
93
|
-
raise Error::UnsupportedOperation, "Method
|
93
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#factory not defined."
|
94
94
|
end
|
95
95
|
|
96
96
|
# === SFS 1.1 Description
|
@@ -105,7 +105,37 @@ module RGeo
|
|
105
105
|
# point geometries, 1 for curves, and 2 for surfaces.
|
106
106
|
|
107
107
|
def dimension
|
108
|
-
raise Error::UnsupportedOperation, "Method
|
108
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#dimension not defined."
|
109
|
+
end
|
110
|
+
|
111
|
+
# === SFS 1.2 Description
|
112
|
+
#
|
113
|
+
# The coordinate dimension is the dimension of direct positions (coordinate tuples) used in
|
114
|
+
# the definition of this geometric object
|
115
|
+
#
|
116
|
+
# === Notes
|
117
|
+
#
|
118
|
+
# Difference between this and dimension is that this is the dimension of the coordinate
|
119
|
+
# not the dimension of the geometry.
|
120
|
+
#
|
121
|
+
# @return [Integer]
|
122
|
+
def coordinate_dimension
|
123
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#coordinate_dimension not defined."
|
124
|
+
end
|
125
|
+
|
126
|
+
# === SFS 1.2 Description
|
127
|
+
#
|
128
|
+
# The spatial dimension is the dimension of the spatial portion of the direct positions
|
129
|
+
# (coordinate tuples) used in the definition of this geometric object. If the direct positions
|
130
|
+
# do not carry a measure coordinate, this will be equal to the coordinate dimension.
|
131
|
+
#
|
132
|
+
# === Notes
|
133
|
+
#
|
134
|
+
# Similar to coordinate_dimension except it will ignore the M component always.
|
135
|
+
#
|
136
|
+
# @return [Integer]
|
137
|
+
def spatial_dimension
|
138
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#spatial_dimension not defined."
|
109
139
|
end
|
110
140
|
|
111
141
|
# === SFS 1.1 Description
|
@@ -122,7 +152,7 @@ module RGeo
|
|
122
152
|
# call the +type_name+ method of the returned module.
|
123
153
|
|
124
154
|
def geometry_type
|
125
|
-
raise Error::UnsupportedOperation, "Method
|
155
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#geometry_type not defined."
|
126
156
|
end
|
127
157
|
|
128
158
|
# === SFS 1.1 Description
|
@@ -137,7 +167,7 @@ module RGeo
|
|
137
167
|
# stored in either the same or some other datastore.
|
138
168
|
|
139
169
|
def srid
|
140
|
-
raise Error::UnsupportedOperation, "Method
|
170
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#srid not defined."
|
141
171
|
end
|
142
172
|
|
143
173
|
# === SFS 1.1 Description
|
@@ -151,7 +181,7 @@ module RGeo
|
|
151
181
|
# Returns an object that supports the Geometry interface.
|
152
182
|
|
153
183
|
def envelope
|
154
|
-
raise Error::UnsupportedOperation, "Method
|
184
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#envelope not defined."
|
155
185
|
end
|
156
186
|
|
157
187
|
# === SFS 1.1 Description
|
@@ -164,7 +194,7 @@ module RGeo
|
|
164
194
|
# Returns an ASCII string.
|
165
195
|
|
166
196
|
def as_text
|
167
|
-
raise Error::UnsupportedOperation, "Method
|
197
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#as_text not defined."
|
168
198
|
end
|
169
199
|
|
170
200
|
# === SFS 1.1 Description
|
@@ -177,7 +207,7 @@ module RGeo
|
|
177
207
|
# Returns a binary string.
|
178
208
|
|
179
209
|
def as_binary
|
180
|
-
raise Error::UnsupportedOperation, "Method
|
210
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#as_binary not defined."
|
181
211
|
end
|
182
212
|
|
183
213
|
# === SFS 1.1 Description
|
@@ -192,7 +222,7 @@ module RGeo
|
|
192
222
|
# specification, which stipulates an integer return value.
|
193
223
|
|
194
224
|
def empty?
|
195
|
-
raise Error::UnsupportedOperation, "Method
|
225
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#empty? not defined."
|
196
226
|
end
|
197
227
|
|
198
228
|
def is_empty?
|
@@ -214,7 +244,7 @@ module RGeo
|
|
214
244
|
# specification, which stipulates an integer return value.
|
215
245
|
|
216
246
|
def simple?
|
217
|
-
raise Error::UnsupportedOperation, "Method
|
247
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#simple? not defined."
|
218
248
|
end
|
219
249
|
|
220
250
|
def is_simple?
|
@@ -222,6 +252,28 @@ module RGeo
|
|
222
252
|
simple?
|
223
253
|
end
|
224
254
|
|
255
|
+
# === SFS 1.2 Description
|
256
|
+
#
|
257
|
+
# Returns 1 (TRUE) if this geometric object has z coordinate values.
|
258
|
+
#
|
259
|
+
# === Notes
|
260
|
+
#
|
261
|
+
# @return [Boolean]
|
262
|
+
def is_3d?
|
263
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#is_3d? not defined."
|
264
|
+
end
|
265
|
+
|
266
|
+
# === SFS 1.2 Description
|
267
|
+
#
|
268
|
+
# Returns 1 (TRUE) if this geometric object has m coordinate values.
|
269
|
+
#
|
270
|
+
# === Notes
|
271
|
+
#
|
272
|
+
# @return [Boolean]
|
273
|
+
def measured?
|
274
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#measured? not defined."
|
275
|
+
end
|
276
|
+
|
225
277
|
# === SFS 1.1 Description
|
226
278
|
#
|
227
279
|
# Returns the closure of the combinatorial boundary of this geometric
|
@@ -234,7 +286,7 @@ module RGeo
|
|
234
286
|
# Returns an object that supports the Geometry interface.
|
235
287
|
|
236
288
|
def boundary
|
237
|
-
raise Error::UnsupportedOperation, "Method
|
289
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#boundary not defined."
|
238
290
|
end
|
239
291
|
|
240
292
|
# === SFS 1.1 Description
|
@@ -253,7 +305,7 @@ module RGeo
|
|
253
305
|
# from different factories is undefined.
|
254
306
|
|
255
307
|
def equals?(another_geometry)
|
256
|
-
raise Error::UnsupportedOperation, "Method
|
308
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#equals? not defined."
|
257
309
|
end
|
258
310
|
|
259
311
|
# === SFS 1.1 Description
|
@@ -272,7 +324,7 @@ module RGeo
|
|
272
324
|
# from different factories is undefined.
|
273
325
|
|
274
326
|
def disjoint?(another_geometry)
|
275
|
-
raise Error::UnsupportedOperation, "Method
|
327
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#disjoint? not defined."
|
276
328
|
end
|
277
329
|
|
278
330
|
# === SFS 1.1 Description
|
@@ -291,7 +343,7 @@ module RGeo
|
|
291
343
|
# from different factories is undefined.
|
292
344
|
|
293
345
|
def intersects?(another_geometry)
|
294
|
-
raise Error::UnsupportedOperation, "Method
|
346
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#intersects? not defined."
|
295
347
|
end
|
296
348
|
|
297
349
|
# === SFS 1.1 Description
|
@@ -310,7 +362,7 @@ module RGeo
|
|
310
362
|
# from different factories is undefined.
|
311
363
|
|
312
364
|
def touches?(another_geometry)
|
313
|
-
raise Error::UnsupportedOperation, "Method
|
365
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#touches? not defined."
|
314
366
|
end
|
315
367
|
|
316
368
|
# === SFS 1.1 Description
|
@@ -329,7 +381,7 @@ module RGeo
|
|
329
381
|
# from different factories is undefined.
|
330
382
|
|
331
383
|
def crosses?(another_geometry)
|
332
|
-
raise Error::UnsupportedOperation, "Method
|
384
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#crosses? not defined."
|
333
385
|
end
|
334
386
|
|
335
387
|
# === SFS 1.1 Description
|
@@ -348,7 +400,7 @@ module RGeo
|
|
348
400
|
# from different factories is undefined.
|
349
401
|
|
350
402
|
def within?(another_geometry)
|
351
|
-
raise Error::UnsupportedOperation, "Method
|
403
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#within? not defined."
|
352
404
|
end
|
353
405
|
|
354
406
|
# === SFS 1.1 Description
|
@@ -367,7 +419,7 @@ module RGeo
|
|
367
419
|
# from different factories is undefined.
|
368
420
|
|
369
421
|
def contains?(another_geometry)
|
370
|
-
raise Error::UnsupportedOperation, "Method
|
422
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#contains? not defined."
|
371
423
|
end
|
372
424
|
|
373
425
|
# === SFS 1.1 Description
|
@@ -386,7 +438,7 @@ module RGeo
|
|
386
438
|
# from different factories is undefined.
|
387
439
|
|
388
440
|
def overlaps?(another_geometry)
|
389
|
-
raise Error::UnsupportedOperation, "Method
|
441
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#overlaps? not defined."
|
390
442
|
end
|
391
443
|
|
392
444
|
# === SFS 1.1 Description
|
@@ -412,7 +464,34 @@ module RGeo
|
|
412
464
|
# from different factories is undefined.
|
413
465
|
|
414
466
|
def relate?(another_geometry, _intersection_pattern_matrix_)
|
415
|
-
raise Error::UnsupportedOperation, "Method
|
467
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#relate not defined."
|
468
|
+
end
|
469
|
+
|
470
|
+
# === SFS 1.2 Description
|
471
|
+
#
|
472
|
+
# Returns a derived geometry collection value that matches the
|
473
|
+
# specified m coordinate value.
|
474
|
+
#
|
475
|
+
# === Notes
|
476
|
+
#
|
477
|
+
# @param m_value [Float] value to find matches for
|
478
|
+
# @return [RGeo::Feature::GeometryCollection]
|
479
|
+
def locate_along
|
480
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#locate_along not defined."
|
481
|
+
end
|
482
|
+
|
483
|
+
# === SFS 1.2 Description
|
484
|
+
#
|
485
|
+
# Returns a derived geometry collection value
|
486
|
+
# that matches the specified range of m coordinate values inclusively
|
487
|
+
#
|
488
|
+
# === Notes
|
489
|
+
#
|
490
|
+
# @param m_start [Float] lower bound of value range
|
491
|
+
# @param m_end [Float] upper bound of value range
|
492
|
+
# @return [RGeo::Feature::GeometryCollection]
|
493
|
+
def locate_between
|
494
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#locate_between not defined."
|
416
495
|
end
|
417
496
|
|
418
497
|
# === SFS 1.1 Description
|
@@ -431,7 +510,7 @@ module RGeo
|
|
431
510
|
# distance between objects from different factories is undefined.
|
432
511
|
|
433
512
|
def distance(another_geometry)
|
434
|
-
raise Error::UnsupportedOperation, "Method
|
513
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#distance not defined."
|
435
514
|
end
|
436
515
|
|
437
516
|
# === SFS 1.1 Description
|
@@ -446,7 +525,7 @@ module RGeo
|
|
446
525
|
# Returns an object that supports the Geometry interface.
|
447
526
|
|
448
527
|
def buffer(_distance_)
|
449
|
-
raise Error::UnsupportedOperation, "Method
|
528
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#buffer not defined."
|
450
529
|
end
|
451
530
|
|
452
531
|
# === SFS 1.1 Description
|
@@ -459,7 +538,7 @@ module RGeo
|
|
459
538
|
# Returns an object that supports the Geometry interface.
|
460
539
|
|
461
540
|
def convex_hull
|
462
|
-
raise Error::UnsupportedOperation, "Method
|
541
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#convex_hull not defined."
|
463
542
|
end
|
464
543
|
|
465
544
|
# === SFS 1.1 Description
|
@@ -477,7 +556,7 @@ module RGeo
|
|
477
556
|
# operations on objects from different factories is undefined.
|
478
557
|
|
479
558
|
def intersection(another_geometry)
|
480
|
-
raise Error::UnsupportedOperation, "Method
|
559
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#intersection not defined."
|
481
560
|
end
|
482
561
|
|
483
562
|
# === SFS 1.1 Description
|
@@ -495,7 +574,7 @@ module RGeo
|
|
495
574
|
# operations on objects from different factories is undefined.
|
496
575
|
|
497
576
|
def union(another_geometry)
|
498
|
-
raise Error::UnsupportedOperation, "Method
|
577
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#union not defined."
|
499
578
|
end
|
500
579
|
|
501
580
|
# === SFS 1.1 Description
|
@@ -513,7 +592,7 @@ module RGeo
|
|
513
592
|
# operations on objects from different factories is undefined.
|
514
593
|
|
515
594
|
def difference(another_geometry)
|
516
|
-
raise Error::UnsupportedOperation, "Method
|
595
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#difference not defined."
|
517
596
|
end
|
518
597
|
|
519
598
|
# === SFS 1.1 Description
|
@@ -531,7 +610,7 @@ module RGeo
|
|
531
610
|
# operations on objects from different factories is undefined.
|
532
611
|
|
533
612
|
def sym_difference(another_geometry)
|
534
|
-
raise Error::UnsupportedOperation, "Method
|
613
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#sym_difference not defined."
|
535
614
|
end
|
536
615
|
|
537
616
|
# Returns true if this geometric object is representationally
|
@@ -543,7 +622,7 @@ module RGeo
|
|
543
622
|
# from different factories is undefined.
|
544
623
|
|
545
624
|
def rep_equals?(another_geometry)
|
546
|
-
raise Error::UnsupportedOperation, "Method
|
625
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#rep_equals? not defined."
|
547
626
|
end
|
548
627
|
|
549
628
|
# Unions a collection of Geometry or a single Geometry
|
@@ -560,7 +639,7 @@ module RGeo
|
|
560
639
|
# returns nil.
|
561
640
|
#
|
562
641
|
def unary_union
|
563
|
-
raise Error::UnsupportedOperation, "Method
|
642
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#unary_union not defined."
|
564
643
|
end
|
565
644
|
|
566
645
|
# This method should behave almost the same as the rep_equals?
|
@@ -44,7 +44,7 @@ module RGeo
|
|
44
44
|
# Returns an integer.
|
45
45
|
|
46
46
|
def num_geometries
|
47
|
-
raise Error::UnsupportedOperation, "Method
|
47
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#num_geometries not defined."
|
48
48
|
end
|
49
49
|
|
50
50
|
# === SFS 1.1 Description
|
@@ -59,7 +59,7 @@ module RGeo
|
|
59
59
|
# in that it does not support negative indexes.
|
60
60
|
|
61
61
|
def geometry_n(n)
|
62
|
-
raise Error::UnsupportedOperation, "Method
|
62
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#geometry_n not defined."
|
63
63
|
end
|
64
64
|
|
65
65
|
# Alias of the num_geometries method.
|
@@ -79,13 +79,13 @@ module RGeo
|
|
79
79
|
# returns nil, where [-1] returns the last element of the collection.
|
80
80
|
|
81
81
|
def [](n)
|
82
|
-
raise Error::UnsupportedOperation, "Method
|
82
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#[] not defined."
|
83
83
|
end
|
84
84
|
|
85
85
|
# Nodes the linework in a list of Geometries
|
86
86
|
#
|
87
87
|
def node
|
88
|
-
raise Error::UnsupportedOperation, "Method
|
88
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#node not defined."
|
89
89
|
end
|
90
90
|
|
91
91
|
# Iterates over the geometries of this GeometryCollection.
|
@@ -96,7 +96,15 @@ module RGeo
|
|
96
96
|
# include the Enumerable mixin.
|
97
97
|
|
98
98
|
def each(&block)
|
99
|
-
raise Error::UnsupportedOperation, "Method
|
99
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#each not defined."
|
100
|
+
end
|
101
|
+
|
102
|
+
# Gives a point that is guaranteed to be within the geometry.
|
103
|
+
#
|
104
|
+
# Extends OGC SFS 1.1 and follows PostGIS standards.
|
105
|
+
# @see https://postgis.net/docs/ST_PointOnSurface.html
|
106
|
+
def point_on_surface
|
107
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#each not defined."
|
100
108
|
end
|
101
109
|
end
|
102
110
|
end
|
@@ -34,7 +34,7 @@ module RGeo
|
|
34
34
|
# Returns an integer.
|
35
35
|
|
36
36
|
def num_points
|
37
|
-
raise Error::UnsupportedOperation, "Method
|
37
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#num_points not defined."
|
38
38
|
end
|
39
39
|
|
40
40
|
# === SFS 1.1 Description
|
@@ -48,14 +48,14 @@ module RGeo
|
|
48
48
|
# Does not support negative indexes.
|
49
49
|
|
50
50
|
def point_n(n)
|
51
|
-
raise Error::UnsupportedOperation, "Method
|
51
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#point_n not defined."
|
52
52
|
end
|
53
53
|
|
54
54
|
# Returns the constituent points as an array of objects that
|
55
55
|
# support the Point interface.
|
56
56
|
|
57
57
|
def points
|
58
|
-
raise Error::UnsupportedOperation, "Method
|
58
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#points not defined."
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -43,7 +43,7 @@ module RGeo
|
|
43
43
|
# Returns a floating-point scalar value.
|
44
44
|
|
45
45
|
def area
|
46
|
-
raise Error::UnsupportedOperation, "Method
|
46
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#area not defined."
|
47
47
|
end
|
48
48
|
|
49
49
|
# === SFS 1.1 Description
|
@@ -56,7 +56,7 @@ module RGeo
|
|
56
56
|
# Returns an object that supports the Point interface.
|
57
57
|
|
58
58
|
def centroid
|
59
|
-
raise Error::UnsupportedOperation, "Method
|
59
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#centroid not defined."
|
60
60
|
end
|
61
61
|
|
62
62
|
# === SFS 1.1 Description
|
@@ -68,7 +68,7 @@ module RGeo
|
|
68
68
|
# Returns an object that supports the Point interface.
|
69
69
|
|
70
70
|
def point_on_surface
|
71
|
-
raise Error::UnsupportedOperation, "Method
|
71
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#point_on_surface not defined."
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/rgeo/feature/point.rb
CHANGED
@@ -47,7 +47,7 @@ module RGeo
|
|
47
47
|
# Returns a floating-point scalar value.
|
48
48
|
|
49
49
|
def x
|
50
|
-
raise Error::UnsupportedOperation, "Method
|
50
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#x not defined."
|
51
51
|
end
|
52
52
|
|
53
53
|
# === SFS 1.1 Description
|
@@ -59,7 +59,7 @@ module RGeo
|
|
59
59
|
# Returns a floating-point scalar value.
|
60
60
|
|
61
61
|
def y
|
62
|
-
raise Error::UnsupportedOperation, "Method
|
62
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#y not defined."
|
63
63
|
end
|
64
64
|
|
65
65
|
# Returns the z-coordinate for this Point as a floating-point
|
@@ -69,7 +69,7 @@ module RGeo
|
|
69
69
|
# not support Z coordinates.
|
70
70
|
|
71
71
|
def z
|
72
|
-
raise Error::UnsupportedOperation, "Method
|
72
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#z not defined."
|
73
73
|
end
|
74
74
|
|
75
75
|
# Returns the m-coordinate for this Point as a floating-point
|
@@ -79,7 +79,7 @@ module RGeo
|
|
79
79
|
# not support M coordinates.
|
80
80
|
|
81
81
|
def m
|
82
|
-
raise Error::UnsupportedOperation, "Method
|
82
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#m not defined."
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
data/lib/rgeo/feature/surface.rb
CHANGED
@@ -49,7 +49,7 @@ module RGeo
|
|
49
49
|
# Returns a floating-point scalar value.
|
50
50
|
|
51
51
|
def area
|
52
|
-
raise Error::UnsupportedOperation, "Method
|
52
|
+
raise Error::UnsupportedOperation, "Method #{self.class.name}#area not defined."
|
53
53
|
end
|
54
54
|
|
55
55
|
# === SFS 1.1 Description
|
@@ -62,7 +62,7 @@ module RGeo
|
|
62
62
|
# Returns an object that supports the Point interface.
|
63
63
|
|
64
64
|
def centroid
|
65
|
-
raise Error::UnsupportedOperation, "Method
|
65
|
+
raise Error::UnsupportedOperation, "Method #{self.class.name}#centroid not defined."
|
66
66
|
end
|
67
67
|
|
68
68
|
# === SFS 1.1 Description
|
@@ -74,7 +74,7 @@ module RGeo
|
|
74
74
|
# Returns an object that supports the Point interface.
|
75
75
|
|
76
76
|
def point_on_surface
|
77
|
-
raise Error::UnsupportedOperation, "Method
|
77
|
+
raise Error::UnsupportedOperation, "Method #{self.class.name}#point_on_surface not defined."
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -31,6 +31,11 @@ module RGeo
|
|
31
31
|
@multi_polygon_class = Geographic.const_get("#{impl_prefix}MultiPolygonImpl")
|
32
32
|
@support_z = opts[:has_z_coordinate] ? true : false
|
33
33
|
@support_m = opts[:has_m_coordinate] ? true : false
|
34
|
+
@coordinate_dimension = 2
|
35
|
+
@coordinate_dimension += 1 if @support_z
|
36
|
+
@coordinate_dimension += 1 if @support_m
|
37
|
+
@spatial_dimension = @support_z ? 3 : 2
|
38
|
+
|
34
39
|
@srid = (opts[:srid] || 4326).to_i
|
35
40
|
@proj4 = opts[:proj4]
|
36
41
|
if @proj4 && CoordSys.check!(:proj4)
|
@@ -42,7 +47,6 @@ module RGeo
|
|
42
47
|
if @coord_sys.is_a?(String)
|
43
48
|
@coord_sys = CoordSys::CS.create_from_wkt(@coord_sys)
|
44
49
|
end
|
45
|
-
@lenient_assertions = opts[:uses_lenient_assertions] ? true : false
|
46
50
|
@buffer_resolution = opts[:buffer_resolution].to_i
|
47
51
|
@buffer_resolution = 1 if @buffer_resolution < 1
|
48
52
|
|
@@ -76,6 +80,7 @@ module RGeo
|
|
76
80
|
end
|
77
81
|
@projector = nil
|
78
82
|
end
|
83
|
+
attr_reader :coordinate_dimension, :spatial_dimension
|
79
84
|
|
80
85
|
# Equivalence test.
|
81
86
|
|
@@ -106,7 +111,6 @@ module RGeo
|
|
106
111
|
"wkbg" => @wkb_generator.properties,
|
107
112
|
"wktp" => @wkt_parser.properties,
|
108
113
|
"wkbp" => @wkb_parser.properties,
|
109
|
-
"lena" => @lenient_assertions,
|
110
114
|
"bufr" => @buffer_resolution
|
111
115
|
}
|
112
116
|
hash_["proj4"] = @proj4.marshal_dump if @proj4
|
@@ -138,7 +142,6 @@ module RGeo
|
|
138
142
|
wkb_generator: symbolize_hash(data_["wkbg"]),
|
139
143
|
wkt_parser: symbolize_hash(data_["wktp"]),
|
140
144
|
wkb_parser: symbolize_hash(data_["wkbp"]),
|
141
|
-
uses_lenient_assertions: data_["lena"],
|
142
145
|
buffer_resolution: data_["bufr"],
|
143
146
|
proj4: proj4,
|
144
147
|
coord_sys: coord_sys
|
@@ -164,7 +167,6 @@ module RGeo
|
|
164
167
|
coder["wkb_generator"] = @wkb_generator.properties
|
165
168
|
coder["wkt_parser"] = @wkt_parser.properties
|
166
169
|
coder["wkb_parser"] = @wkb_parser.properties
|
167
|
-
coder["lenient_assertions"] = @lenient_assertions
|
168
170
|
coder["buffer_resolution"] = @buffer_resolution
|
169
171
|
if @proj4
|
170
172
|
str = @proj4.original_str || @proj4.canonical_str
|
@@ -201,7 +203,6 @@ module RGeo
|
|
201
203
|
wkb_generator: symbolize_hash(coder["wkb_generator"]),
|
202
204
|
wkt_parser: symbolize_hash(coder["wkt_parser"]),
|
203
205
|
wkb_parser: symbolize_hash(coder["wkb_parser"]),
|
204
|
-
uses_lenient_assertions: coder["lenient_assertions"],
|
205
206
|
buffer_resolution: coder["buffer_resolution"],
|
206
207
|
proj4: proj4,
|
207
208
|
coord_sys: coord_sys
|
@@ -293,8 +294,6 @@ module RGeo
|
|
293
294
|
@support_z
|
294
295
|
when :has_m_coordinate
|
295
296
|
@support_m
|
296
|
-
when :uses_lenient_assertions
|
297
|
-
@lenient_assertions
|
298
297
|
when :buffer_resolution
|
299
298
|
@buffer_resolution
|
300
299
|
when :is_geographic
|