Sha256: dab8d8e4f47f5fbf97ef790c4e9833ed6998159bd1beb95190b324feb5cdb13e
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
require 'geo_ruby/simple_features/geometry_collection' module GeoRuby module SimpleFeatures # Represents a group of points (see Point). class MultiPoint < GeometryCollection def initialize(srid = DEFAULT_SRID, with_z = false, with_m = false) super(srid, with_z, with_m) end def binary_geometry_type #:nodoc: 4 end def points @geometries end # Text representation of a MultiPoint def text_representation(allow_z = true, allow_m = true) #:nodoc: '(' + @geometries.collect { |point| point.text_representation(allow_z, allow_m) }.join('),(') + ')' end # WKT geoemtry type def text_geometry_type #:nodoc: 'MULTIPOINT' end def to_coordinates points.map(&:to_coordinates) end def as_json(_options = {}) { type: 'MultiPoint', coordinates: to_coordinates } end # Creates a new multi point from an array of points 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 # Creates a new multi point from a list of point coordinates : ((x,y)...(x,y)) 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 end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
geekdaily-georuby-2.6.0 | lib/geo_ruby/simple_features/multi_point.rb |
georuby-2.5.2 | lib/geo_ruby/simple_features/multi_point.rb |
georuby-2.5.1 | lib/geo_ruby/simple_features/multi_point.rb |