Class: GeoRuby::SimpleFeatures::MultiPoint
- Inherits:
-
GeometryCollection
- Object
- Geometry
- GeometryCollection
- GeoRuby::SimpleFeatures::MultiPoint
- Defined in:
- lib/geo_ruby/simple_features/multi_point.rb
Overview
Represents a group of points (see Point).
Instance Attribute Summary
Attributes inherited from GeometryCollection
Attributes inherited from Geometry
Class Method Summary collapse
-
.from_coordinates(points, srid = DEFAULT_SRID, with_z = false, with_m = false) ⇒ Object
Creates a new multi point from a list of point coordinates : ((x,y)…(x,y)).
-
.from_points(points, srid = DEFAULT_SRID, with_z = false, with_m = false) ⇒ Object
Creates a new multi point from an array of points.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#binary_geometry_type ⇒ Object
:nodoc:.
-
#initialize(srid = DEFAULT_SRID, with_z = false, with_m = false) ⇒ MultiPoint
constructor
A new instance of MultiPoint.
- #points ⇒ Object
-
#text_geometry_type ⇒ Object
WKT geoemtry type.
-
#text_representation(allow_z = true, allow_m = true) ⇒ Object
Text representation of a MultiPoint.
- #to_coordinates ⇒ Object
-
#to_json(options = {}) ⇒ Object
(also: #as_geojson)
simple geojson representation TODO add CRS / SRID support?.
Methods inherited from GeometryCollection
#==, #binary_representation, #bounding_box, from_geometries, #georss_gml_representation, #georss_simple_representation, #georss_w3cgeo_representation, #kml_representation, #m_range, #method_missing
Methods inherited from Geometry
#as_ewkb, #as_ewkt, #as_georss, #as_hex_ewkb, #as_hex_wkb, #as_kml, #as_wkb, #as_wkt, #bounding_box, #envelope, from_ewkb, from_ewkt, from_geojson, from_georss, from_georss_with_tags, from_hex_ewkb, from_kml, #m_range
Constructor Details
#initialize(srid = DEFAULT_SRID, with_z = false, with_m = false) ⇒ MultiPoint
Returns a new instance of MultiPoint.
8 9 10 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 8 def initialize(srid= DEFAULT_SRID,with_z=false,with_m=false) super(srid,with_z,with_m) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GeoRuby::SimpleFeatures::GeometryCollection
Class Method Details
.from_coordinates(points, srid = DEFAULT_SRID, with_z = false, with_m = false) ⇒ Object
Creates a new multi point from a list of point coordinates : ((x,y)…(x,y))
54 55 56 57 58 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 54 def self.from_coordinates(points,srid= DEFAULT_SRID,with_z=false,with_m=false) multi_point= new(srid,with_z,with_m) multi_point.concat(points.collect {|point| Point.from_coordinates(point,srid,with_z,with_m)}) multi_point end |
.from_points(points, srid = DEFAULT_SRID, with_z = false, with_m = false) ⇒ Object
Creates a new multi point from an array of points
47 48 49 50 51 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 47 def self.from_points(points,srid= DEFAULT_SRID,with_z=false,with_m=false) multi_point= new(srid,with_z,with_m) multi_point.concat(points) multi_point end |
Instance Method Details
#as_json(options = {}) ⇒ Object
34 35 36 37 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 34 def as_json( = {}) {:type => 'MultiPoint', :coordinates => self.to_coordinates} end |
#binary_geometry_type ⇒ Object
:nodoc:
12 13 14 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 12 def binary_geometry_type #:nodoc: 4 end |
#points ⇒ Object
16 17 18 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 16 def points @geometries end |
#text_geometry_type ⇒ Object
WKT geoemtry type
26 27 28 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 26 def text_geometry_type #:nodoc: "MULTIPOINT" end |
#text_representation(allow_z = true, allow_m = true) ⇒ Object
Text representation of a MultiPoint
21 22 23 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 21 def text_representation(allow_z=true,allow_m=true) #:nodoc: "(" + @geometries.collect{|point| point.text_representation(allow_z,allow_m)}.join("),(") + ")" end |
#to_coordinates ⇒ Object
30 31 32 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 30 def to_coordinates points.map{|p| p.to_coordinates } end |
#to_json(options = {}) ⇒ Object Also known as: as_geojson
simple geojson representation TODO add CRS / SRID support?
41 42 43 |
# File 'lib/geo_ruby/simple_features/multi_point.rb', line 41 def to_json( = {}) as_json().to_json() end |