rgeo 3.0.0.pre.rc.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/README.md +11 -11
- data/ext/geos_c_impl/factory.c +31 -30
- data/ext/geos_c_impl/factory.h +8 -1
- data/ext/geos_c_impl/geometry.c +70 -0
- data/ext/geos_c_impl/geometry_collection.c +43 -40
- data/ext/geos_c_impl/line_string.c +2 -2
- data/ext/geos_c_impl/main.c +1 -1
- data/ext/geos_c_impl/polygon.c +29 -22
- data/ext/geos_c_impl/preface.h +4 -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/factory.rb +6 -7
- data/lib/rgeo/cartesian/feature_classes.rb +2 -0
- data/lib/rgeo/cartesian/feature_methods.rb +16 -0
- data/lib/rgeo/cartesian/interface.rb +0 -30
- data/lib/rgeo/coord_sys.rb +0 -11
- data/lib/rgeo/feature/factory_generator.rb +0 -3
- data/lib/rgeo/feature/geometry.rb +79 -0
- data/lib/rgeo/geographic/factory.rb +6 -0
- data/lib/rgeo/geographic/interface.rb +1 -29
- data/lib/rgeo/geographic/projected_feature_methods.rb +16 -0
- data/lib/rgeo/geographic/spherical_feature_methods.rb +17 -1
- data/lib/rgeo/geos/capi_factory.rb +0 -7
- data/lib/rgeo/geos/capi_feature_classes.rb +19 -0
- data/lib/rgeo/geos/ffi_factory.rb +6 -7
- data/lib/rgeo/geos/ffi_feature_methods.rb +16 -0
- data/lib/rgeo/geos/interface.rb +0 -17
- data/lib/rgeo/geos/zm_factory.rb +0 -7
- data/lib/rgeo/geos/zm_feature_methods.rb +16 -0
- data/lib/rgeo/geos.rb +6 -3
- data/lib/rgeo/impl_helper/validity_check.rb +3 -2
- data/lib/rgeo/version.rb +1 -1
- metadata +18 -5
- 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
@@ -69,11 +69,6 @@ module RGeo
|
|
69
69
|
# The coordinate system in OGC form, either as a subclass of
|
70
70
|
# CoordSys::CS::CoordinateSystem, or as a string in WKT format.
|
71
71
|
# Optional.
|
72
|
-
# [<tt>:srs_database</tt>]
|
73
|
-
# Optional. If provided, the value should be an implementation of
|
74
|
-
# CoordSys::SRSDatabase::Interface. If both this and an SRID are
|
75
|
-
# provided, they are used to look up the proj4 and coord_sys
|
76
|
-
# objects from a spatial reference system database.
|
77
72
|
# [<tt>:has_z_coordinate</tt>]
|
78
73
|
# Support a Z coordinate. Default is false.
|
79
74
|
# [<tt>:has_m_coordinate</tt>]
|
@@ -101,31 +96,6 @@ module RGeo
|
|
101
96
|
def simple_factory(opts = {})
|
102
97
|
Cartesian::Factory.new(opts)
|
103
98
|
end
|
104
|
-
|
105
|
-
# Returns a Feature::FactoryGenerator that creates preferred
|
106
|
-
# factories. The given options are used as the default options.
|
107
|
-
#
|
108
|
-
# A common case for this is to provide the <tt>:srs_database</tt>
|
109
|
-
# as a default. Then, the factory generator need only be passed
|
110
|
-
# an SRID and it will automatically fetch the appropriate Proj4
|
111
|
-
# and CoordSys objects.
|
112
|
-
|
113
|
-
def preferred_factory_generator(defaults = {})
|
114
|
-
proc { |c| preferred_factory(defaults.merge(c)) }
|
115
|
-
end
|
116
|
-
alias factory_generator preferred_factory_generator
|
117
|
-
|
118
|
-
# Returns a Feature::FactoryGenerator that creates simple factories.
|
119
|
-
# The given options are used as the default options.
|
120
|
-
#
|
121
|
-
# A common case for this is to provide the <tt>:srs_database</tt>
|
122
|
-
# as a default. Then, the factory generator need only be passed
|
123
|
-
# an SRID and it will automatically fetch the appropriate Proj4
|
124
|
-
# and CoordSys objects.
|
125
|
-
|
126
|
-
def simple_factory_generator(defaults = {})
|
127
|
-
proc { |c| simple_factory(defaults.merge(c)) }
|
128
|
-
end
|
129
99
|
end
|
130
100
|
end
|
131
101
|
end
|
data/lib/rgeo/coord_sys.rb
CHANGED
@@ -9,9 +9,6 @@
|
|
9
9
|
require_relative "coord_sys/cs/factories"
|
10
10
|
require_relative "coord_sys/cs/entities"
|
11
11
|
require_relative "coord_sys/cs/wkt_parser"
|
12
|
-
require_relative "coord_sys/srs_database/entry"
|
13
|
-
require_relative "coord_sys/srs_database/url_reader"
|
14
|
-
require_relative "coord_sys/srs_database/sr_org"
|
15
12
|
|
16
13
|
module RGeo
|
17
14
|
# This module provides data structures and tools related to coordinate
|
@@ -26,14 +23,6 @@ module RGeo
|
|
26
23
|
# This includes classes for representing ellipsoids, datums, coordinate
|
27
24
|
# systems, and other related concepts, as well as a parser for the WKT
|
28
25
|
# format for specifying coordinate systems.
|
29
|
-
#
|
30
|
-
# The RGeo::CoordSys::SRSDatabase module contains tools for accessing
|
31
|
-
# spatial reference databases, from which you can look up coordinate
|
32
|
-
# system specifications. You can access the <tt>spatial_ref_sys</tt>
|
33
|
-
# table provided with OGC-compliant spatial databases such as PostGIS,
|
34
|
-
# read the databases provided with the proj4 library, or access URLs
|
35
|
-
# such as those provided by spatialreference.org.
|
36
|
-
|
37
26
|
module CoordSys
|
38
27
|
# The only valid key is :proj4
|
39
28
|
def self.supported?(key)
|
@@ -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>]
|
@@ -108,6 +108,36 @@ module RGeo
|
|
108
108
|
raise Error::UnsupportedOperation, "Method #{self.class}#dimension not defined."
|
109
109
|
end
|
110
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."
|
139
|
+
end
|
140
|
+
|
111
141
|
# === SFS 1.1 Description
|
112
142
|
#
|
113
143
|
# Returns the instantiable subtype of Geometry of which this
|
@@ -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
|
@@ -415,6 +467,33 @@ module RGeo
|
|
415
467
|
raise Error::UnsupportedOperation, "Method #{self.class}#relate not defined."
|
416
468
|
end
|
417
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."
|
495
|
+
end
|
496
|
+
|
418
497
|
# === SFS 1.1 Description
|
419
498
|
#
|
420
499
|
# Returns the shortest distance between any two Points in the two
|
@@ -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)
|
@@ -75,6 +80,7 @@ module RGeo
|
|
75
80
|
end
|
76
81
|
@projector = nil
|
77
82
|
end
|
83
|
+
attr_reader :coordinate_dimension, :spatial_dimension
|
78
84
|
|
79
85
|
# Equivalence test.
|
80
86
|
|
@@ -83,11 +83,6 @@ module RGeo
|
|
83
83
|
# visualization crs". You may alternatively wish to set the srid
|
84
84
|
# to 4326, indicating the WGS84 crs, but note that that value
|
85
85
|
# implies an ellipsoidal datum, not a spherical datum.
|
86
|
-
# [<tt>:srs_database</tt>]
|
87
|
-
# Optional. If provided, the object should respond to #get and
|
88
|
-
# #clear_cache. If both this and an SRID are
|
89
|
-
# provided, they are used to look up the proj4 and coord_sys
|
90
|
-
# objects from a spatial reference system database.
|
91
86
|
# [<tt>:wkt_parser</tt>]
|
92
87
|
# Configure the parser for WKT. The value is a hash of
|
93
88
|
# configuration parameters for WKRep::WKTParser.new. Default is
|
@@ -112,13 +107,6 @@ module RGeo
|
|
112
107
|
proj4 = opts[:proj4]
|
113
108
|
coord_sys = opts[:coord_sys]
|
114
109
|
srid = opts[:srid]
|
115
|
-
if (!proj4 || !coord_sys) && srid && (db_ = opts[:srs_database])
|
116
|
-
entry_ = db_.get(srid.to_i)
|
117
|
-
if entry_
|
118
|
-
proj4 ||= entry_.proj4
|
119
|
-
coord_sys ||= entry_.coord_sys
|
120
|
-
end
|
121
|
-
end
|
122
110
|
srid ||= coord_sys.authority_code if coord_sys
|
123
111
|
Geographic::Factory.new("Spherical",
|
124
112
|
has_z_coordinate: opts[:has_z_coordinate],
|
@@ -247,9 +235,7 @@ module RGeo
|
|
247
235
|
# and let this method construct a projection factory for you (which
|
248
236
|
# it will do using the preferred Cartesian factory generator).
|
249
237
|
# If you choose this second method, you may provide the proj4
|
250
|
-
#
|
251
|
-
# by providing both an <tt>:srid</tt> and a <tt>:srs_database</tt>
|
252
|
-
# to use to look up the coordinate system.
|
238
|
+
# via the <tt>:projection_proj4</tt> option.
|
253
239
|
#
|
254
240
|
# Following are detailed descriptions of the various options you can
|
255
241
|
# pass to this method.
|
@@ -292,11 +278,6 @@ module RGeo
|
|
292
278
|
# The SRID value to use for the main geographic factory. Defaults
|
293
279
|
# to the given geographic coordinate system's authority code, or
|
294
280
|
# to 0 if no geographic coordinate system is known.
|
295
|
-
# [<tt>:srs_database</tt>]
|
296
|
-
# Optional. If provided, the object should respond to #get and
|
297
|
-
# #clear_cache. If both this and an SRID are
|
298
|
-
# provided, they are used to look up the proj4 and coord_sys
|
299
|
-
# objects from a spatial reference system database.
|
300
281
|
# [<tt>:has_z_coordinate</tt>]
|
301
282
|
# Support a Z coordinate. Default is false.
|
302
283
|
# Note: this is ignored if a <tt>:projection_factory</tt> is
|
@@ -335,7 +316,6 @@ module RGeo
|
|
335
316
|
|
336
317
|
def projected_factory(opts = {})
|
337
318
|
CoordSys.check!(:proj4)
|
338
|
-
db_ = opts[:srs_database]
|
339
319
|
if (projection_factory = opts[:projection_factory])
|
340
320
|
# Get the projection coordinate systems from the given factory
|
341
321
|
projection_proj4 = projection_factory.proj4
|
@@ -350,14 +330,6 @@ module RGeo
|
|
350
330
|
proj4 = opts[:proj4]
|
351
331
|
coord_sys = opts[:coord_sys]
|
352
332
|
srid = opts[:srid]
|
353
|
-
# Lookup srid from srs database if needed
|
354
|
-
if (!proj4 || !coord_sys) && srid && db_
|
355
|
-
entry_ = db_.get(srid.to_i)
|
356
|
-
if entry_
|
357
|
-
proj4 ||= entry_.proj4
|
358
|
-
coord_sys ||= entry_.coord_sys
|
359
|
-
end
|
360
|
-
end
|
361
333
|
# Fall back to getting the values from the projection.
|
362
334
|
proj4 ||= projection_proj4.get_geographic || _proj_4326
|
363
335
|
coord_sys ||= projection_coord_sys.geographic_coordinate_system if projection_coord_sys
|
@@ -22,6 +22,22 @@ module RGeo
|
|
22
22
|
factory.unproject(projection.unsafe_envelope)
|
23
23
|
end
|
24
24
|
|
25
|
+
def coordinate_dimension
|
26
|
+
factory.coordinate_dimension
|
27
|
+
end
|
28
|
+
|
29
|
+
def spatial_dimension
|
30
|
+
factory.spatial_dimension
|
31
|
+
end
|
32
|
+
|
33
|
+
def is_3d?
|
34
|
+
factory.property(:has_z_coordinate)
|
35
|
+
end
|
36
|
+
|
37
|
+
def measured?
|
38
|
+
factory.property(:has_m_coordinate)
|
39
|
+
end
|
40
|
+
|
25
41
|
def empty?
|
26
42
|
projection.empty?
|
27
43
|
end
|
@@ -12,6 +12,22 @@ module RGeo
|
|
12
12
|
def srid
|
13
13
|
factory.srid
|
14
14
|
end
|
15
|
+
|
16
|
+
def coordinate_dimension
|
17
|
+
factory.coordinate_dimension
|
18
|
+
end
|
19
|
+
|
20
|
+
def spatial_dimension
|
21
|
+
factory.spatial_dimension
|
22
|
+
end
|
23
|
+
|
24
|
+
def is_3d?
|
25
|
+
factory.property(:has_z_coordinate)
|
26
|
+
end
|
27
|
+
|
28
|
+
def measured?
|
29
|
+
factory.property(:has_m_coordinate)
|
30
|
+
end
|
15
31
|
end
|
16
32
|
|
17
33
|
module SphericalPointMethods # :nodoc:
|
@@ -216,7 +232,7 @@ module RGeo
|
|
216
232
|
centroid_lat /= (6.0 * signed_area)
|
217
233
|
centroid_lng /= (6.0 * signed_area)
|
218
234
|
|
219
|
-
|
235
|
+
factory.point(centroid_lat, centroid_lng)
|
220
236
|
end
|
221
237
|
end
|
222
238
|
end
|
@@ -71,13 +71,6 @@ module RGeo
|
|
71
71
|
if coord_sys_.is_a?(String)
|
72
72
|
coord_sys_ = CoordSys::CS.create_from_wkt(coord_sys_)
|
73
73
|
end
|
74
|
-
if (!proj4_ || !coord_sys_) && srid_ && (db_ = opts_[:srs_database])
|
75
|
-
entry_ = db_.get(srid_.to_i)
|
76
|
-
if entry_
|
77
|
-
proj4_ ||= entry_.proj4
|
78
|
-
coord_sys_ ||= entry_.coord_sys
|
79
|
-
end
|
80
|
-
end
|
81
74
|
srid_ ||= coord_sys_.authority_code if coord_sys_
|
82
75
|
|
83
76
|
# Create the factory and set instance variables
|
@@ -13,6 +13,17 @@ module RGeo
|
|
13
13
|
module CAPIGeometryMethods
|
14
14
|
include Feature::Instance
|
15
15
|
|
16
|
+
def coordinate_dimension
|
17
|
+
dim = 2
|
18
|
+
dim += 1 if factory.supports_z?
|
19
|
+
dim += 1 if factory.supports_m?
|
20
|
+
dim
|
21
|
+
end
|
22
|
+
|
23
|
+
def spatial_dimension
|
24
|
+
factory.supports_z? ? 3 : 2
|
25
|
+
end
|
26
|
+
|
16
27
|
def is_empty? # rubocop:disable Naming/PredicateName
|
17
28
|
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
18
29
|
empty?
|
@@ -23,6 +34,14 @@ module RGeo
|
|
23
34
|
simple?
|
24
35
|
end
|
25
36
|
|
37
|
+
def is_3d?
|
38
|
+
factory.supports_z?
|
39
|
+
end
|
40
|
+
|
41
|
+
def measured?
|
42
|
+
factory.supports_m?
|
43
|
+
end
|
44
|
+
|
26
45
|
def inspect
|
27
46
|
"#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>"
|
28
47
|
end
|
@@ -25,6 +25,11 @@ module RGeo
|
|
25
25
|
if @has_z && @has_m
|
26
26
|
raise Error::UnsupportedOperation, "GEOS cannot support both Z and M coordinates at the same time."
|
27
27
|
end
|
28
|
+
@coordinate_dimension = 2
|
29
|
+
@coordinate_dimension += 1 if @has_z
|
30
|
+
@coordinate_dimension += 1 if @has_m
|
31
|
+
@spatial_dimension = @has_z ? 3 : 2
|
32
|
+
|
28
33
|
@_has_3d = @has_z || @has_m
|
29
34
|
@buffer_resolution = opts[:buffer_resolution].to_i
|
30
35
|
@buffer_resolution = 1 if @buffer_resolution < 1
|
@@ -70,13 +75,6 @@ module RGeo
|
|
70
75
|
if @coord_sys.is_a?(String)
|
71
76
|
@coord_sys = CoordSys::CS.create_from_wkt(@coord_sys)
|
72
77
|
end
|
73
|
-
if (!@proj4 || !@coord_sys) && @srid && (db = opts[:srs_database])
|
74
|
-
entry = db.get(@srid.to_i)
|
75
|
-
if entry
|
76
|
-
@proj4 ||= entry.proj4
|
77
|
-
@coord_sys ||= entry.coord_sys
|
78
|
-
end
|
79
|
-
end
|
80
78
|
@srid ||= @coord_sys.authority_code if @coord_sys
|
81
79
|
@srid = @srid.to_i
|
82
80
|
|
@@ -106,6 +104,7 @@ module RGeo
|
|
106
104
|
@wkb_reader = nil
|
107
105
|
end
|
108
106
|
end
|
107
|
+
attr_reader :coordinate_dimension, :spatial_dimension
|
109
108
|
|
110
109
|
# Standard object inspection output
|
111
110
|
|
@@ -77,6 +77,14 @@ module RGeo
|
|
77
77
|
Utils.ffi_compute_dimension(@fg_geom)
|
78
78
|
end
|
79
79
|
|
80
|
+
def coordinate_dimension
|
81
|
+
factory.coordinate_dimension
|
82
|
+
end
|
83
|
+
|
84
|
+
def spatial_dimension
|
85
|
+
factory.spatial_dimension
|
86
|
+
end
|
87
|
+
|
80
88
|
def geometry_type
|
81
89
|
Feature::Geometry
|
82
90
|
end
|
@@ -131,6 +139,14 @@ module RGeo
|
|
131
139
|
simple?
|
132
140
|
end
|
133
141
|
|
142
|
+
def is_3d?
|
143
|
+
factory.property(:has_z_coordinate)
|
144
|
+
end
|
145
|
+
|
146
|
+
def measured?
|
147
|
+
factory.property(:has_m_coordinate)
|
148
|
+
end
|
149
|
+
|
134
150
|
def valid?
|
135
151
|
@fg_geom.valid?
|
136
152
|
end
|
data/lib/rgeo/geos/interface.rb
CHANGED
@@ -135,11 +135,6 @@ module RGeo
|
|
135
135
|
# The coordinate system in OGC form, either as a subclass of
|
136
136
|
# CoordSys::CS::CoordinateSystem, or as a string in WKT format.
|
137
137
|
# Optional.
|
138
|
-
# [<tt>:srs_database</tt>]
|
139
|
-
# Optional. If provided, the object should respond to #get and
|
140
|
-
# #clear_cache. If both this and an SRID are
|
141
|
-
# provided, they are used to look up the proj4 and coord_sys
|
142
|
-
# objects from a spatial reference system database.
|
143
138
|
# [<tt>:has_z_coordinate</tt>]
|
144
139
|
# Support <tt>z_coordinate</tt>. Default is false.
|
145
140
|
# [<tt>:has_m_coordinate</tt>]
|
@@ -194,18 +189,6 @@ module RGeo
|
|
194
189
|
end
|
195
190
|
end
|
196
191
|
end
|
197
|
-
|
198
|
-
# Returns a Feature::FactoryGenerator that creates Geos-backed
|
199
|
-
# factories. The given options are used as the default options.
|
200
|
-
#
|
201
|
-
# A common case for this is to provide the <tt>:srs_database</tt>
|
202
|
-
# as a default. Then, the factory generator need only be passed
|
203
|
-
# an SRID and it will automatically fetch the appropriate Proj4
|
204
|
-
# and CoordSys objects.
|
205
|
-
|
206
|
-
def factory_generator(defaults = {})
|
207
|
-
proc { |c| factory(defaults.merge(c)) }
|
208
|
-
end
|
209
192
|
end
|
210
193
|
end
|
211
194
|
end
|
data/lib/rgeo/geos/zm_factory.rb
CHANGED
@@ -44,13 +44,6 @@ module RGeo
|
|
44
44
|
proj4 = opts[:proj4]
|
45
45
|
coord_sys = opts[:coord_sys]
|
46
46
|
srid = opts[:srid]
|
47
|
-
if (!proj4 || !coord_sys) && srid && (db = opts[:srs_database])
|
48
|
-
entry = db.get(srid.to_i)
|
49
|
-
if entry
|
50
|
-
proj4 ||= entry.proj4
|
51
|
-
coord_sys ||= entry.coord_sys
|
52
|
-
end
|
53
|
-
end
|
54
47
|
srid ||= coord_sys.authority_code if coord_sys
|
55
48
|
config = {
|
56
49
|
buffer_resolution: opts[:buffer_resolution], auto_prepare: opts[:auto_prepare],
|
@@ -45,6 +45,14 @@ module RGeo
|
|
45
45
|
@zgeometry.dimension
|
46
46
|
end
|
47
47
|
|
48
|
+
def coordinate_dimension
|
49
|
+
4
|
50
|
+
end
|
51
|
+
|
52
|
+
def spatial_dimension
|
53
|
+
3
|
54
|
+
end
|
55
|
+
|
48
56
|
def geometry_type
|
49
57
|
@zgeometry.geometry_type
|
50
58
|
end
|
@@ -83,6 +91,14 @@ module RGeo
|
|
83
91
|
simple?
|
84
92
|
end
|
85
93
|
|
94
|
+
def is_3d?
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
def measured?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
86
102
|
def boundary
|
87
103
|
@factory.create_feature(nil, @zgeometry.boundary, @mgeometry.boundary)
|
88
104
|
end
|
data/lib/rgeo/geos.rb
CHANGED
@@ -33,9 +33,6 @@ module RGeo
|
|
33
33
|
require_relative "geos/capi_feature_classes"
|
34
34
|
require_relative "geos/capi_factory"
|
35
35
|
end
|
36
|
-
require_relative "geos/ffi_feature_methods"
|
37
|
-
require_relative "geos/ffi_feature_classes"
|
38
|
-
require_relative "geos/ffi_factory"
|
39
36
|
require_relative "geos/zm_feature_methods"
|
40
37
|
require_relative "geos/zm_feature_classes"
|
41
38
|
require_relative "geos/zm_factory"
|
@@ -56,6 +53,12 @@ module RGeo
|
|
56
53
|
FFI_SUPPORT_EXCEPTION = ex
|
57
54
|
end
|
58
55
|
|
56
|
+
if FFI_SUPPORTED
|
57
|
+
require_relative "geos/ffi_feature_methods"
|
58
|
+
require_relative "geos/ffi_feature_classes"
|
59
|
+
require_relative "geos/ffi_factory"
|
60
|
+
end
|
61
|
+
|
59
62
|
# Default preferred native interface
|
60
63
|
if CAPI_SUPPORTED
|
61
64
|
self.preferred_native_interface = :capi
|
@@ -22,13 +22,14 @@ module RGeo
|
|
22
22
|
UNCHECKED_METHODS = [
|
23
23
|
# Basic methods
|
24
24
|
:factory, :geometry_type, :as_text, :as_binary, :srid,
|
25
|
+
:dimension, :coordinate_dimension, :spatial_dimension,
|
25
26
|
# Tests
|
26
|
-
:simple?, :closed?, :empty?,
|
27
|
+
:simple?, :closed?, :empty?, :is_3d?, :measured?,
|
27
28
|
# Accessors
|
28
29
|
:exterior_ring, :interior_rings, :[], :num_geometries, :num_interior_rings,
|
29
30
|
:geometry_n, :each, :points, :point_n, :start_point, :end_point, :x, :y, :z, :m,
|
30
31
|
# Trivial methods
|
31
|
-
:num_points,
|
32
|
+
:num_points, :locate_along, :locate_between,
|
32
33
|
# Comparison
|
33
34
|
:equals?, :rep_equals?, :eql?, :==, :'!='
|
34
35
|
].freeze
|
data/lib/rgeo/version.rb
CHANGED
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: 3.0.0.pre.rc.
|
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: 2022-
|
12
|
+
date: 2022-07-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi-geos
|
@@ -81,6 +81,20 @@ 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'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: yard
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,8 @@ files:
|
|
136
150
|
- ext/geos_c_impl/polygon.c
|
137
151
|
- ext/geos_c_impl/polygon.h
|
138
152
|
- ext/geos_c_impl/preface.h
|
153
|
+
- ext/geos_c_impl/ruby_more.c
|
154
|
+
- ext/geos_c_impl/ruby_more.h
|
139
155
|
- lib/rgeo.rb
|
140
156
|
- lib/rgeo/cartesian.rb
|
141
157
|
- lib/rgeo/cartesian/analysis.rb
|
@@ -152,9 +168,6 @@ files:
|
|
152
168
|
- lib/rgeo/coord_sys/cs/entities.rb
|
153
169
|
- lib/rgeo/coord_sys/cs/factories.rb
|
154
170
|
- lib/rgeo/coord_sys/cs/wkt_parser.rb
|
155
|
-
- lib/rgeo/coord_sys/srs_database/entry.rb
|
156
|
-
- lib/rgeo/coord_sys/srs_database/sr_org.rb
|
157
|
-
- lib/rgeo/coord_sys/srs_database/url_reader.rb
|
158
171
|
- lib/rgeo/error.rb
|
159
172
|
- lib/rgeo/feature.rb
|
160
173
|
- lib/rgeo/feature/curve.rb
|