Sha256: de83b37fec758cc87b259cd1c88f9803c889586bc6b405dc480246da98f795e9

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 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)
        super(srid)
      end
      
      def binary_geometry_type
        4
      end
      #Text representation of a MultiPoint
      def text_representation(dimension=2)
        @geometries.collect{|point| point.text_representation(dimension)}.join(",")
      end
      #WKT geoemtry type
      def text_geometry_type
        "MULTIPOINT"
      end

      #Creates a new multi point from an array of points
      def self.from_points(points,srid= DEFAULT_SRID)
        multi_point= MultiPoint::new(srid)
        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_raw_point_sequence(point_sequence,srid= DEFAULT_SRID)
        multi_point= MultiPoint::new(srid)
        multi_point.concat(point_sequence.collect {|point| Point.from_coordinates(point,srid)})
        multi_point
      end
      
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
GeoRuby-0.0.1 lib/geo_ruby/simple_features/multi_point.rb
GeoRuby-0.0.3 lib/geo_ruby/simple_features/multi_point.rb
GeoRuby-0.0.2 lib/geo_ruby/simple_features/multi_point.rb
GeoRuby-0.0.4 lib/geo_ruby/simple_features/multi_point.rb