Module: RGeo::GeoJSON::CollectionMethods
- Included in:
- FeatureCollection
- Defined in:
- lib/rgeo/geo_json/collection_methods.rb
Overview
This module is here to fill the gap between what is a GeometryCollection (GIS) and a FeatureCollection (GeoJSON).
Note for contributors, you can rely on ‘@features` to be defined and you can consider working with an Enumerable wrapping `@features`. See GeoJSON::FeatureCollection.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object (private)
19 20 21 22 23 24 25 |
# File 'lib/rgeo/geo_json/collection_methods.rb', line 19 private def method_missing(symbol, *args) return super unless any? { |feature| feature.respond_to?(symbol) } raise Error::UnsupportedOperation, "Method FeatureCollection##{symbol} " \ "is not defined. You may consider filing an issue or opening a pull " \ "request at https://github.com/rgeo/rgeo-geojson" end |
Instance Method Details
#contains?(geometry) ⇒ Boolean
27 28 29 |
# File 'lib/rgeo/geo_json/collection_methods.rb', line 27 def contains?(geometry) any? { |feature| feature.contains?(geometry) } end |
#intersects?(geometry) ⇒ Boolean
31 32 33 |
# File 'lib/rgeo/geo_json/collection_methods.rb', line 31 def intersects?(geometry) any? { |feature| feature.intersects?(geometry) } end |