class GeoRuby::SimpleFeatures::MultiLineString

Represents a group of line strings (see LineString).

Public Class Methods

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

Creates a new multi line string from sequences of points : (((x,y)…(x,y)),((x,y)…(x,y)))

# File lib/geo_ruby/simple_features/multi_line_string.rb, line 49
def self.from_coordinates(point_sequences, srid = DEFAULT_SRID, with_z = false, with_m = false)
  multi_line_string = new(srid, with_z, with_m)
  multi_line_string.concat(point_sequences.collect { |points| LineString.from_coordinates(points, srid, with_z, with_m) })
  multi_line_string
end
from_line_strings(line_strings, srid = DEFAULT_SRID, with_z = false, with_m = false) click to toggle source

Creates a new multi line string from an array of line strings

# File lib/geo_ruby/simple_features/multi_line_string.rb, line 42
def self.from_line_strings(line_strings, srid = DEFAULT_SRID, with_z = false, with_m = false)
  multi_line_string = new(srid, with_z, with_m)
  multi_line_string.concat(line_strings)
  multi_line_string
end
new(srid = DEFAULT_SRID, _with_z = false, _with_m = false) click to toggle source
# File lib/geo_ruby/simple_features/multi_line_string.rb, line 7
def initialize(srid = DEFAULT_SRID, _with_z = false, _with_m = false)
  super(srid)
end

Public Instance Methods

as_json(_options = {}) click to toggle source
# File lib/geo_ruby/simple_features/multi_line_string.rb, line 37
def as_json(_options = {})
  { type: 'MultiLineString', coordinates: to_coordinates }
end
points() click to toggle source
# File lib/geo_ruby/simple_features/multi_line_string.rb, line 15
def points
  geometries.map(&:points).flatten
end
to_coordinates() click to toggle source
# File lib/geo_ruby/simple_features/multi_line_string.rb, line 33
def to_coordinates
  geometries.map(&:to_coordinates)
end
to_line_string(_join = true) click to toggle source
# File lib/geo_ruby/simple_features/multi_line_string.rb, line 29
def to_line_string(_join = true)
  LineString.from_points(points)
end