Class: Charta::GeometryCollection
- Defined in:
- lib/charta/geometry_collection.rb
Overview
Represent a Geometry with contains other geometries
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Geometry
#!=, #==, #area, #bounding_box, #buffer, #centroid, #collection?, #convert_to, #difference, #empty?, #ewkt, factory, feature, #feature, #feature=, #find_srid, #flatten_multi, from_ewkt, from_rgeo, #initialize, #inspect, #intersection, #intersects?, #merge, #method_missing, #point_on_surface, #respond_to_missing?, #srid, srs_database, #surface?, #to_binary, #to_ewkt, #to_geojson, #to_json_feature, #to_json_object, #to_rgeo, #to_svg, #to_svg_path, #to_text, #transform, #type
Constructor Details
This class inherits a constructor from Charta::Geometry
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Charta::Geometry
Class Method Details
.empty(srid = nil) ⇒ Object
5 6 7 8 9 |
# File 'lib/charta/geometry_collection.rb', line 5 def empty(srid = nil) srid = Charta.find_srid(srid.nil? ? :WGS84 : srid) feature = Charta.new_feature('GEOMETRYCOLLECTION EMPTY', srid) new(feature) end |
Instance Method Details
#to_json_feature_collection(collection_properties = []) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/charta/geometry_collection.rb', line 12 def to_json_feature_collection(collection_properties = []) features = feature.each.with_index.collect do |f, i| properties = {} properties = collection_properties[i] unless collection_properties[i].nil? Charta.new_geometry(f).to_json_feature(properties) end { type: 'FeatureCollection', features: features } end |