class GeoRuby::SimpleFeatures::MultiPoint

Represents a group of points (see Point).

Public Class Methods

from_coordinates(points, srid = DEFAULT_SRID, with_z = false, with_m = false) click to toggle source

Creates a new multi point from a list of point coordinates : ((x,y)…(x,y))

# File lib/geo_ruby/simple_features/multi_point.rb, line 45
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) click to toggle source

Creates a new multi point from an array of points

# File lib/geo_ruby/simple_features/multi_point.rb, line 38
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
new(srid = DEFAULT_SRID, with_z = false, with_m = false) click to toggle source
# File lib/geo_ruby/simple_features/multi_point.rb, line 7
def initialize(srid = DEFAULT_SRID, with_z = false, with_m = false)
  super(srid, with_z, with_m)
end

Public Instance Methods

as_json(_options = {}) click to toggle source
# File lib/geo_ruby/simple_features/multi_point.rb, line 33
def as_json(_options = {})
  { type: 'MultiPoint', coordinates: to_coordinates }
end
points() click to toggle source
# File lib/geo_ruby/simple_features/multi_point.rb, line 15
def points
  @geometries
end
to_coordinates() click to toggle source
# File lib/geo_ruby/simple_features/multi_point.rb, line 29
def to_coordinates
  points.map(&:to_coordinates)
end