A GeometryCollection is a geometric object that is a collection of 1 or more geometric objects.
All the elements in a GeometryCollection shall be in the same Spatial Reference. This is also the Spatial Reference for the GeometryCollection.
GeometryCollection places no other constraints on its elements. Subclasses of GeometryCollection may restrict membership based on dimension and may also place other constraints on the degree of spatial overlap between elements.
GeometryCollection is defined as a module and is provided primarily for the sake of documentation. Implementations need not necessarily include this module itself. Therefore, you should not depend on the kind_of? method to check type. Instead, use the provided check_type class method (or === operator) defined in the Type module.
Returns the Nth geometry in this GeometryCollection, or nil if the given N is out of range. N is zero-based.
This behaves slightly different from #geometry_n. #geometry_n accepts only nonnegative indexes, as specified by the SFS. However, GeometryCollection#[] also accepts negative indexes counting backwards from the end of the collection, the same way Ruby’s array indexing works. Hence, #geometry_n(-1) returns nil, where [-1] returns the last element of the collection.
# File lib/rgeo/feature/geometry_collection.rb, line 117 def [](n_) raise Error::UnsupportedOperation, "Method GeometryCollection#[] not defined." end
Iterates over the geometries of this GeometryCollection.
This is not a standard SFS method, but is provided so that a GeometryCollection can behave as a Ruby enumerable. Note that all GeometryCollection implementations must also include the Enumerable mixin.
# File lib/rgeo/feature/geometry_collection.rb, line 129 def each(&block_) raise Error::UnsupportedOperation, "Method GeometryCollection#each not defined." end
Returns the Nth geometry in this GeometryCollection.
Returns an object that supports the Geometry interface, or nil if the given N is out of range. N is zero-based. Also note that this method is different from GeometryCollection#[] in that it does not support negative indexes.
# File lib/rgeo/feature/geometry_collection.rb, line 95 def geometry_n(n_) raise Error::UnsupportedOperation, "Method GeometryCollection#geometry_n not defined." end
Returns the number of geometries in this GeometryCollection.
Returns an integer.
# File lib/rgeo/feature/geometry_collection.rb, line 79 def num_geometries raise Error::UnsupportedOperation, "Method GeometryCollection#num_geometries not defined." end
Alias of the #num_geometries method.
# File lib/rgeo/feature/geometry_collection.rb, line 102 def size num_geometries end