rgeo 0.1.21 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +11 -0
- data/README.rdoc +1 -1
- data/Spatial_Programming_With_RGeo.rdoc +382 -0
- data/Version +1 -1
- data/lib/active_record/connection_adapters/postgis_adapter.rb +1 -1
- data/lib/rgeo.rb +4 -4
- data/lib/rgeo/active_record/base_modifications.rb +1 -1
- data/lib/rgeo/all.rb +1 -1
- data/lib/rgeo/cartesian/bounding_box.rb +2 -2
- data/lib/rgeo/cartesian/factory.rb +18 -11
- data/lib/rgeo/cartesian/interface.rb +4 -4
- data/lib/rgeo/coord_sys.rb +8 -1
- data/lib/rgeo/coord_sys/proj4.rb +4 -4
- data/lib/rgeo/feature/factory.rb +68 -49
- data/lib/rgeo/feature/factory_generator.rb +2 -2
- data/lib/rgeo/feature/types.rb +4 -4
- data/lib/rgeo/geo_json/coder.rb +5 -5
- data/lib/rgeo/{geography.rb → geographic.rb} +15 -15
- data/lib/rgeo/{geography → geographic}/factory.rb +27 -20
- data/lib/rgeo/{geography → geographic}/interface.rb +43 -29
- data/lib/rgeo/{geography → geographic}/proj4_projector.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_feature_classes.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_feature_methods.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_window.rb +5 -5
- data/lib/rgeo/{geography → geographic}/simple_mercator_projector.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_feature_classes.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_feature_methods.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_math.rb +1 -1
- data/lib/rgeo/geos/factory.rb +22 -15
- data/lib/rgeo/geos/interface.rb +3 -3
- data/lib/rgeo/geos/zm_factory.rb +20 -6
- data/lib/rgeo/impl_helper/basic_point_methods.rb +2 -2
- data/lib/rgeo/shapefile/reader.rb +5 -5
- data/lib/rgeo/wkrep/wkb_generator.rb +2 -2
- data/lib/rgeo/wkrep/wkb_parser.rb +4 -4
- data/lib/rgeo/wkrep/wkt_generator.rb +2 -2
- data/lib/rgeo/wkrep/wkt_parser.rb +7 -7
- data/test/active_record/common_setup_methods.rb +1 -1
- data/test/geos/tc_point.rb +3 -3
- data/test/geos/tc_zmfactory.rb +7 -7
- data/test/{projected_geography → projected_geographic}/tc_geometry_collection.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_line_string.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_line_string.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_point.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_polygon.rb +3 -3
- data/test/{projected_geography → projected_geographic}/tc_point.rb +5 -5
- data/test/{projected_geography → projected_geographic}/tc_polygon.rb +2 -2
- data/test/shapefile/tc_shapelib_tests.rb +10 -10
- data/test/simple_cartesian/tc_point.rb +3 -3
- data/test/simple_mercator/tc_geometry_collection.rb +1 -1
- data/test/simple_mercator/tc_line_string.rb +1 -1
- data/test/simple_mercator/tc_multi_line_string.rb +1 -1
- data/test/simple_mercator/tc_multi_point.rb +1 -1
- data/test/simple_mercator/tc_multi_polygon.rb +2 -2
- data/test/simple_mercator/tc_point.rb +4 -4
- data/test/simple_mercator/tc_polygon.rb +1 -1
- data/test/simple_mercator/tc_window.rb +39 -39
- data/test/spherical_geographic/tc_calculations.rb +203 -0
- data/test/{spherical_geography → spherical_geographic}/tc_geometry_collection.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_line_string.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_line_string.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_point.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_polygon.rb +3 -3
- data/test/{spherical_geography → spherical_geographic}/tc_point.rb +6 -6
- data/test/{spherical_geography → spherical_geographic}/tc_polygon.rb +2 -2
- data/test/tc_geojson.rb +3 -3
- data/test/tc_oneoff.rb +5 -5
- data/test/wkrep/tc_wkb_generator.rb +3 -3
- data/test/wkrep/tc_wkb_parser.rb +16 -16
- data/test/wkrep/tc_wkt_generator.rb +3 -3
- data/test/wkrep/tc_wkt_parser.rb +21 -21
- metadata +46 -44
- data/test/spherical_geography/tc_calculations.rb +0 -203
@@ -36,11 +36,11 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
# This class implements the various factories for geography features.
|
43
|
-
# See methods of the RGeo::
|
43
|
+
# See methods of the RGeo::Geographic module for the API for creating
|
44
44
|
# geography factories.
|
45
45
|
|
46
46
|
class Factory
|
@@ -50,17 +50,17 @@ module RGeo
|
|
50
50
|
|
51
51
|
def initialize(impl_prefix_, opts_={}) # :nodoc:
|
52
52
|
@impl_prefix = impl_prefix_
|
53
|
-
@point_class =
|
54
|
-
@line_string_class =
|
55
|
-
@linear_ring_class =
|
56
|
-
@line_class =
|
57
|
-
@polygon_class =
|
58
|
-
@geometry_collection_class =
|
59
|
-
@multi_point_class =
|
60
|
-
@multi_line_string_class =
|
61
|
-
@multi_polygon_class =
|
62
|
-
@support_z = opts_[:
|
63
|
-
@support_m = opts_[:
|
53
|
+
@point_class = Geographic.const_get("#{impl_prefix_}PointImpl")
|
54
|
+
@line_string_class = Geographic.const_get("#{impl_prefix_}LineStringImpl")
|
55
|
+
@linear_ring_class = Geographic.const_get("#{impl_prefix_}LinearRingImpl")
|
56
|
+
@line_class = Geographic.const_get("#{impl_prefix_}LineImpl")
|
57
|
+
@polygon_class = Geographic.const_get("#{impl_prefix_}PolygonImpl")
|
58
|
+
@geometry_collection_class = Geographic.const_get("#{impl_prefix_}GeometryCollectionImpl")
|
59
|
+
@multi_point_class = Geographic.const_get("#{impl_prefix_}MultiPointImpl")
|
60
|
+
@multi_line_string_class = Geographic.const_get("#{impl_prefix_}MultiLineStringImpl")
|
61
|
+
@multi_polygon_class = Geographic.const_get("#{impl_prefix_}MultiPolygonImpl")
|
62
|
+
@support_z = opts_[:has_z_coordinate] ? true : false
|
63
|
+
@support_m = opts_[:has_m_coordinate] ? true : false
|
64
64
|
@srid = opts_[:srid] || 4326
|
65
65
|
@proj4 = opts_[:proj4]
|
66
66
|
if CoordSys::Proj4.supported?
|
@@ -81,7 +81,7 @@ module RGeo
|
|
81
81
|
# Equivalence test.
|
82
82
|
|
83
83
|
def eql?(rhs_)
|
84
|
-
rhs_.is_a?(
|
84
|
+
rhs_.is_a?(Geographic::Factory) &&
|
85
85
|
@impl_prefix == rhs_.instance_variable_get(:@impl_prefix) &&
|
86
86
|
@support_z == rhs_.instance_variable_get(:@support_z) &&
|
87
87
|
@support_m == rhs_.instance_variable_get(:@support_m) &&
|
@@ -166,16 +166,16 @@ module RGeo
|
|
166
166
|
end
|
167
167
|
|
168
168
|
|
169
|
-
# See ::RGeo::Feature::Factory#
|
169
|
+
# See ::RGeo::Feature::Factory#property
|
170
170
|
|
171
|
-
def
|
171
|
+
def property(name_)
|
172
172
|
case name_
|
173
|
-
when :
|
173
|
+
when :has_z_coordinate
|
174
174
|
@support_z
|
175
|
-
when :
|
175
|
+
when :has_m_coordinate
|
176
176
|
@support_m
|
177
|
-
when :
|
178
|
-
|
177
|
+
when :is_geographic
|
178
|
+
true
|
179
179
|
else
|
180
180
|
nil
|
181
181
|
end
|
@@ -266,6 +266,13 @@ module RGeo
|
|
266
266
|
end
|
267
267
|
|
268
268
|
|
269
|
+
# See ::RGeo::Feature::Factory#coord_sys
|
270
|
+
|
271
|
+
def coord_sys
|
272
|
+
nil
|
273
|
+
end
|
274
|
+
|
275
|
+
|
269
276
|
end
|
270
277
|
|
271
278
|
end
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
class << self
|
42
42
|
|
@@ -82,10 +82,10 @@ module RGeo
|
|
82
82
|
# You may use the following options when creating a spherical
|
83
83
|
# factory:
|
84
84
|
#
|
85
|
-
# <tt>:
|
86
|
-
# Support
|
87
|
-
# <tt>:
|
88
|
-
# Support
|
85
|
+
# <tt>:has_z_coordinate</tt>::
|
86
|
+
# Support a Z coordinate. Default is false.
|
87
|
+
# <tt>:has_m_coordinate</tt>::
|
88
|
+
# Support an M coordinate. Default is false.
|
89
89
|
# <tt>:proj4</tt>::
|
90
90
|
# Provide the coordinate system in Proj4 format. You may pass
|
91
91
|
# either an RGeo::CoordSys::Proj4 object, or a string or hash
|
@@ -102,7 +102,7 @@ module RGeo
|
|
102
102
|
# implies an ellipsoidal datum, not a spherical datum.
|
103
103
|
|
104
104
|
def spherical_factory(opts_={})
|
105
|
-
|
105
|
+
Geographic::Factory.new('Spherical', :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate], :proj4 => opts_[:proj4] || '+proj=longlat +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +no_defs', :srid => opts_[:srid] || 4055)
|
106
106
|
end
|
107
107
|
|
108
108
|
|
@@ -161,20 +161,14 @@ module RGeo
|
|
161
161
|
# 4-sided polygon. A resolution of 2 would cause that buffer
|
162
162
|
# to be approximated by an 8-sided polygon. The exact behavior
|
163
163
|
# for different kinds of buffers is defined by GEOS.
|
164
|
-
# <tt>:
|
165
|
-
# Support
|
166
|
-
#
|
167
|
-
#
|
168
|
-
# most support one or the other.
|
169
|
-
# <tt>:support_m_coordinate</tt>::
|
170
|
-
# Support <tt>m_coordinate</tt>. Default is false.
|
171
|
-
# Note that simple_mercator factories cannot support both
|
172
|
-
# <tt>z_coordinate</tt> and <tt>m_coordinate</tt>. They may at
|
173
|
-
# most support one or the other.
|
164
|
+
# <tt>:has_z_coordinate</tt>::
|
165
|
+
# Support a Z coordinate. Default is false.
|
166
|
+
# <tt>:has_m_coordinate</tt>::
|
167
|
+
# Support an M coordinate. Default is false.
|
174
168
|
|
175
169
|
def simple_mercator_factory(opts_={})
|
176
|
-
factory_ =
|
177
|
-
projector_ =
|
170
|
+
factory_ = Geographic::Factory.new('Projected', :proj4 => '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', :srid => 4326, :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])
|
171
|
+
projector_ = Geographic::SimpleMercatorProjector.new(factory_, :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])
|
178
172
|
factory_._set_projector(projector_)
|
179
173
|
factory_
|
180
174
|
end
|
@@ -188,7 +182,7 @@ module RGeo
|
|
188
182
|
# calculations report results in the projected units.
|
189
183
|
#
|
190
184
|
# This implementation is intended for advanced GIS applications
|
191
|
-
# requiring
|
185
|
+
# requiring greater control over the projection being used.
|
192
186
|
#
|
193
187
|
# === Options
|
194
188
|
#
|
@@ -203,7 +197,7 @@ module RGeo
|
|
203
197
|
#
|
204
198
|
# <tt>:projection_factory</tt>::
|
205
199
|
# Specify an existing Cartesian factory to use for the projection.
|
206
|
-
# This factory must
|
200
|
+
# This factory must have a non-nil Proj4.
|
207
201
|
#
|
208
202
|
# Note that in this case, the geography factory's z-coordinate and
|
209
203
|
# m-coordinate availability will be set to match the projection's
|
@@ -232,21 +226,41 @@ module RGeo
|
|
232
226
|
# 4-sided polygon. A resolution of 2 would cause that buffer
|
233
227
|
# to be approximated by an 8-sided polygon. The exact behavior
|
234
228
|
# for different kinds of buffers is defined by GEOS.
|
235
|
-
# <tt>:
|
236
|
-
# Support
|
237
|
-
# <tt>:
|
238
|
-
# Support
|
229
|
+
# <tt>:has_z_coordinate</tt>::
|
230
|
+
# Support a Z coordinate. Default is false.
|
231
|
+
# <tt>:has_m_coordinate</tt>::
|
232
|
+
# Support an M coordinate. Default is false.
|
233
|
+
#
|
234
|
+
# Normally, this geographic factory's actual proj4 projection is
|
235
|
+
# derived from the projection's proj4, by extracting the
|
236
|
+
# corresponding geographic coordinate system from the projected
|
237
|
+
# coordinate system. However, you can override this and provide
|
238
|
+
# your own geographic coordinate system by setting the
|
239
|
+
# <tt>:proj4</tt> option.
|
239
240
|
|
240
241
|
def projected_factory(opts_={})
|
241
242
|
unless CoordSys::Proj4.supported?
|
242
243
|
raise Error::UnsupportedCapability, "Proj4 is not supported because the proj4 library was not found at install time."
|
243
244
|
end
|
244
245
|
if (projection_factory_ = opts_[:projection_factory])
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
246
|
+
projection_proj4_ = projection_factory_.proj4
|
247
|
+
unless projection_proj4_
|
248
|
+
raise ::ArgumentError, 'The :projection_factory does not have a proj4.'
|
249
|
+
end
|
250
|
+
proj4_ = opts_[:proj4] || projection_proj4_.get_geographic || '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
|
251
|
+
factory_ = Geographic::Factory.new('Projected', :proj4 => proj4_, :srid => opts_[:srid] || 4326, :has_z_coordinate => projection_factory_.property(:has_z_coordinate), :has_m_coordinate => projection_factory_.property(:has_m_coordinate))
|
252
|
+
projector_ = Geographic::Proj4Projector.create_from_existing_factory(factory_, projection_factory_)
|
253
|
+
elsif (projection_proj4_ = opts_[:projection_proj4])
|
254
|
+
if projection_proj4_.kind_of?(::String) || projection_proj4_.kind_of?(::Hash)
|
255
|
+
actual_projection_proj4_ = CoordSys::Proj4.create(projection_proj4_)
|
256
|
+
unless actual_projection_proj4_
|
257
|
+
raise ::ArgumentError, "Bad proj4 syntax: #{projection_proj4_.inspect}"
|
258
|
+
end
|
259
|
+
projection_proj4_ = actual_projection_proj4_
|
260
|
+
end
|
261
|
+
proj4_ = opts_[:proj4] || projection_proj4_.get_geographic || '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
|
262
|
+
factory_ = Geographic::Factory.new('Projected', :proj4 => proj4_, :srid => opts_[:srid] || 4326, :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])
|
263
|
+
projector_ = Geographic::Proj4Projector.create_from_proj4(factory_, opts_[:projection_proj4], :srid => opts_[:projection_srid], :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])
|
250
264
|
else
|
251
265
|
raise ::ArgumentError, 'You must provide either :projection_proj4 or :projection_factory.'
|
252
266
|
end
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
class Proj4Projector # :nodoc:
|
@@ -82,7 +82,7 @@ module RGeo
|
|
82
82
|
|
83
83
|
|
84
84
|
def create_from_proj4(geography_factory_, proj4_, opts_={})
|
85
|
-
projection_factory_ = Cartesian.preferred_factory(:proj4 => proj4_, :srid => opts_[:srid], :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :
|
85
|
+
projection_factory_ = Cartesian.preferred_factory(:proj4 => proj4_, :srid => opts_[:srid], :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])
|
86
86
|
new(geography_factory_, projection_factory_)
|
87
87
|
end
|
88
88
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# Projtected geographic feature classes
|
4
4
|
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
# Copyright 2010 Daniel Azuma
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
class ProjectedPointImpl # :nodoc:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# Projected geographic common method definitions
|
4
4
|
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
# Copyright 2010 Daniel Azuma
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
module ProjectedGeometryMethods # :nodoc:
|
@@ -36,19 +36,19 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
# This object represents an axis-aligned rectangle in a map projection
|
43
43
|
# coordinate system. It is commonly used to specify the viewport for a
|
44
44
|
# map visualization, an envelope in a projected coordinate system, or
|
45
|
-
# a spatial constraint. It must be attached to a
|
45
|
+
# a spatial constraint. It must be attached to a Geographic::Factory
|
46
46
|
# that has a projection.
|
47
47
|
|
48
48
|
class ProjectedWindow
|
49
49
|
|
50
50
|
|
51
|
-
# Create a new ProjectedWindow given the
|
51
|
+
# Create a new ProjectedWindow given the Geographic::Factory, and the
|
52
52
|
# x and y extents of the rectangle.
|
53
53
|
#
|
54
54
|
# The window will be intelligently clamped to the limits imposed by
|
@@ -110,10 +110,10 @@ module RGeo
|
|
110
110
|
end
|
111
111
|
|
112
112
|
|
113
|
-
# Returns the
|
113
|
+
# Returns the Geographic::Factory associated with this window.
|
114
114
|
# Note that this factory is the overall geography factory, not the
|
115
115
|
# projected factory (which can be obtained by calling
|
116
|
-
#
|
116
|
+
# Geographic::Factory#projection_factory on this factory).
|
117
117
|
|
118
118
|
def factory
|
119
119
|
@factory
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
class SimpleMercatorProjector # :nodoc:
|
@@ -46,7 +46,7 @@ module RGeo
|
|
46
46
|
|
47
47
|
def initialize(geography_factory_, opts_={})
|
48
48
|
@geography_factory = geography_factory_
|
49
|
-
@projection_factory = Cartesian.preferred_factory(:srid => 3857, :proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :
|
49
|
+
@projection_factory = Cartesian.preferred_factory(:srid => 3857, :proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])
|
50
50
|
end
|
51
51
|
|
52
52
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
#
|
3
|
-
# Spherical
|
3
|
+
# Spherical geographic feature classes
|
4
4
|
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
# Copyright 2010 Daniel Azuma
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
class SphericalPointImpl # :nodoc:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
#
|
3
|
-
# Spherical
|
3
|
+
# Spherical geographic common methods
|
4
4
|
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
# Copyright 2010 Daniel Azuma
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module Geographic
|
40
40
|
|
41
41
|
|
42
42
|
module SphericalGeometryMethods # :nodoc:
|
data/lib/rgeo/geos/factory.rb
CHANGED
@@ -59,8 +59,8 @@ module RGeo
|
|
59
59
|
return nil unless respond_to?(:_create)
|
60
60
|
flags_ = 0
|
61
61
|
flags_ |= 1 if opts_[:lenient_multi_polygon_assertions]
|
62
|
-
flags_ |= 2 if opts_[:
|
63
|
-
flags_ |= 4 if opts_[:
|
62
|
+
flags_ |= 2 if opts_[:has_z_coordinate]
|
63
|
+
flags_ |= 4 if opts_[:has_m_coordinate]
|
64
64
|
if flags_ & 6 == 6
|
65
65
|
raise Error::UnsupportedCapability, "GEOS cannot support both Z and M coordinates at the same time."
|
66
66
|
end
|
@@ -119,16 +119,16 @@ module RGeo
|
|
119
119
|
end
|
120
120
|
|
121
121
|
|
122
|
-
# See ::RGeo::Feature::Factory#
|
122
|
+
# See ::RGeo::Feature::Factory#property
|
123
123
|
|
124
|
-
def
|
124
|
+
def property(name_)
|
125
125
|
case name_
|
126
|
-
when :
|
126
|
+
when :has_z_coordinate
|
127
127
|
_flags & 0x2 != 0
|
128
|
-
when :
|
128
|
+
when :has_m_coordinate
|
129
129
|
_flags & 0x4 != 0
|
130
|
-
when :
|
131
|
-
|
130
|
+
when :is_cartesian
|
131
|
+
true
|
132
132
|
else
|
133
133
|
nil
|
134
134
|
end
|
@@ -223,6 +223,20 @@ module RGeo
|
|
223
223
|
end
|
224
224
|
|
225
225
|
|
226
|
+
# See ::RGeo::Feature::Factory#proj4
|
227
|
+
|
228
|
+
def proj4
|
229
|
+
@proj4
|
230
|
+
end
|
231
|
+
|
232
|
+
|
233
|
+
# See ::RGeo::Feature::Factory#coord_sys
|
234
|
+
|
235
|
+
def coord_sys
|
236
|
+
nil
|
237
|
+
end
|
238
|
+
|
239
|
+
|
226
240
|
# See ::RGeo::Feature::Factory#override_cast
|
227
241
|
|
228
242
|
def override_cast(original_, ntype_, flags_)
|
@@ -262,13 +276,6 @@ module RGeo
|
|
262
276
|
end
|
263
277
|
|
264
278
|
|
265
|
-
# See ::RGeo::Feature::Factory#proj4
|
266
|
-
|
267
|
-
def proj4
|
268
|
-
@proj4
|
269
|
-
end
|
270
|
-
|
271
|
-
|
272
279
|
end
|
273
280
|
|
274
281
|
|
data/lib/rgeo/geos/interface.rb
CHANGED
@@ -88,14 +88,14 @@ module RGeo
|
|
88
88
|
# <tt>:srid</tt>::
|
89
89
|
# Set the SRID returned by geometries created by this factory.
|
90
90
|
# Default is 0.
|
91
|
-
# <tt>:
|
91
|
+
# <tt>:has_z_coordinate</tt>::
|
92
92
|
# Support <tt>z_coordinate</tt>. Default is false.
|
93
|
-
# <tt>:
|
93
|
+
# <tt>:has_m_coordinate</tt>::
|
94
94
|
# Support <tt>m_coordinate</tt>. Default is false.
|
95
95
|
|
96
96
|
def factory(opts_={})
|
97
97
|
if supported?
|
98
|
-
if opts_[:
|
98
|
+
if opts_[:has_z_coordinate] && opts_[:has_m_coordinate]
|
99
99
|
ZMFactory.new(opts_)
|
100
100
|
else
|
101
101
|
Factory.create(opts_)
|