Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow extra co-ordinate values to be stored, to support the extra values

allowed in the GeoJSON spec.
  • Loading branch information...
commit 11370d546b16604c8ff1d09d4c704bde5e3c2d68 1 parent 8bb6920
@lukeredpath authored
View
5 lib/rgeo/impl_helper/basic_point_methods.rb
@@ -41,6 +41,7 @@ module ImplHelper # :nodoc:
module BasicPointMethods # :nodoc:
+ attr_reader :extra
def initialize(factory_, x_, y_, *extra_)
_set_factory(factory_)
@@ -48,9 +49,7 @@ def initialize(factory_, x_, y_, *extra_)
@y = y_.to_f
@z = factory_.property(:has_z_coordinate) ? extra_.shift.to_f : nil
@m = factory_.property(:has_m_coordinate) ? extra_.shift.to_f : nil
- if extra_.size > 0
- raise ::ArgumentError, "Too many arguments for point initializer"
- end
+ @extra = extra_
_validate_geometry
end
View
10 test/common/point_tests.rb
@@ -318,6 +318,16 @@ def test_4d_creation
end
+ def test_creation_with_extra_values
+ point_ = @zmfactory.point(11, 12, 13, 14, 15, 16, 17)
+ assert_equal(11, point_.x)
+ assert_equal(12, point_.y)
+ assert_equal(13, point_.z)
+ assert_equal(14, point_.m)
+ assert_equal([15, 16, 17], point_.extra)
+ end
+
+
def test_wkt_creation_3d
point2_ = @zfactory.parse_wkt('POINT(11 12 13)')
assert_equal(11, point2_.x)
Please sign in to comment.
Something went wrong with that request. Please try again.