Module: RGeo::Feature::GeometryCollection
 Extended by:
 Type
 Includes:
 Enumerable, Geometry
 Included in:
 Cartesian::GeometryCollectionImpl, MultiCurve, MultiPoint, MultiSurface, Geographic::ProjectedGeometryCollectionImpl, Geographic::SphericalGeometryCollectionImpl
 Defined in:
 lib/rgeo/feature/geometry_collection.rb
Overview
SFS 1.1 Description
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.
Notes
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.
Instance Method Summary collapse

#[](n) ⇒ Object
Returns the Nth geometry in this GeometryCollection, or nil if the given N is out of range.

#each(&block) ⇒ Object
Iterates over the geometries of this GeometryCollection.

#geometry_n(n) ⇒ Object
SFS 1.1 Description.

#node ⇒ Object
Nodes the linework in a list of Geometries.

#num_geometries ⇒ Object
SFS 1.1 Description.

#size ⇒ Object
Alias of the num_geometries method.
Methods included from Type
add_subtype, check_type, each_immediate_subtype, extended, subtype_of?, supertype, type_name
Methods included from Geometry
#*, #+, #, #==, #as_binary, #as_text, #boundary, #buffer, #contains?, #convex_hull, #crosses?, #difference, #dimension, #disjoint?, #distance, #empty?, #envelope, #eql?, #equals?, #factory, #geometry_type, #intersection, #intersects?, #is_empty?, #is_simple?, #overlaps?, #relate?, #rep_equals?, #simple?, #srid, #sym_difference, #touches?, #unary_union, #union, #within?
Instance Method Details
#[](n) ⇒ Object
Returns the Nth geometry in this GeometryCollection, or nil if the given N is out of range. N is zerobased.
This behaves slightly different from GeometryCollection#geometry_n. GeometryCollection#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.
81 82 83 
# File 'lib/rgeo/feature/geometry_collection.rb', line 81 def [](n) raise Error::UnsupportedOperation, "Method GeometryCollection#[] not defined." end 
#each(&block) ⇒ Object
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.
98 99 100 
# File 'lib/rgeo/feature/geometry_collection.rb', line 98 def each(&block) raise Error::UnsupportedOperation, "Method GeometryCollection#each not defined." end 
#geometry_n(n) ⇒ Object
SFS 1.1 Description
Returns the Nth geometry in this GeometryCollection.
Notes
Returns an object that supports the Geometry interface, or nil if the given N is out of range. N is zerobased. Also note that this method is different from GeometryCollection#[] in that it does not support negative indexes.
61 62 63 
# File 'lib/rgeo/feature/geometry_collection.rb', line 61 def geometry_n(n) raise Error::UnsupportedOperation, "Method GeometryCollection#geometry_n not defined." end 
#node ⇒ Object
Nodes the linework in a list of Geometries
87 88 89 
# File 'lib/rgeo/feature/geometry_collection.rb', line 87 def node raise Error::UnsupportedOperation, "Method GeometryCollection#node not defined." end 
#num_geometries ⇒ Object
SFS 1.1 Description
Returns the number of geometries in this GeometryCollection.
Notes
Returns an integer.
46 47 48 
# File 'lib/rgeo/feature/geometry_collection.rb', line 46 def num_geometries raise Error::UnsupportedOperation, "Method GeometryCollection#num_geometries not defined." end 
#size ⇒ Object
Alias of the num_geometries method.
67 68 69 
# File 'lib/rgeo/feature/geometry_collection.rb', line 67 def size num_geometries end 