Module: RGeo::Feature::GeometryCollection

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.

Constant Summary

Constants included from Type

Type::Instance

Instance Method Summary collapse

Methods included from Type

check_type, subtype_of?, type_name

Methods included from Geometry

#*, #+, #-, #==, #as_binary, #as_text, #boundary, #buffer, #contains?, #convex_hull, #crosses?, #difference, #dimension, #disjoint?, #distance, #envelope, #eql?, #equals?, #factory, #geometry_type, #intersection, #intersects?, #is_empty?, #is_simple?, #overlaps?, #relate, #srid, #sym_difference, #touches?, #union, #within?

Instance Method Details

#[](n_) ⇒ Object

Alias of the geometry_n method.



107
108
109
# File 'lib/rgeo/feature/geometry_collection.rb', line 107

def [](n_)
  geometry_n(n_)
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.



119
120
121
# File 'lib/rgeo/feature/geometry_collection.rb', line 119

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.



93
94
95
# File 'lib/rgeo/feature/geometry_collection.rb', line 93

def geometry_n(n_)
  raise Error::UnsupportedOperation, "Method GeometryCollection#geometry_n not defined."
end

#num_geometriesObject

SFS 1.1 Description

Returns the number of geometries in this GeometryCollection.

Notes

Returns an integer.



79
80
81
# File 'lib/rgeo/feature/geometry_collection.rb', line 79

def num_geometries
  raise Error::UnsupportedOperation, "Method GeometryCollection#num_geometries not defined."
end

#sizeObject

Alias of the num_geometries method.



100
101
102
# File 'lib/rgeo/feature/geometry_collection.rb', line 100

def size
  num_geometries
end