mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
21 lines
395 B
Ruby
21 lines
395 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Tracks::BuildPath
|
|
def initialize(coordinates)
|
|
@coordinates = coordinates
|
|
end
|
|
|
|
def call
|
|
factory.line_string(
|
|
coordinates.map { |point| factory.point(point[1].to_f.round(5), point[0].to_f.round(5)) }
|
|
)
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :coordinates
|
|
|
|
def factory
|
|
@factory ||= RGeo::Geographic.spherical_factory(srid: 3857)
|
|
end
|
|
end
|