Module: Broutes

Defined in:
lib/broutes.rb,
lib/broutes/maths.rb,
lib/broutes/formats.rb,
lib/broutes/version.rb,
lib/broutes/geo_point.rb,
lib/broutes/geo_route.rb

Defined Under Namespace

Modules: Formats, Maths Classes: GeoPoint, GeoRoute

Constant Summary collapse

RAD_PER_DEG =

PI/180

0.017453293
EARTH_RADIUS =

m

6371000
VERSION =
"0.2.0".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject



22
23
24
# File 'lib/broutes.rb', line 22

def logger
  @logger ||= Logger.new(STDOUT)
end

Class Method Details

.from_file(file, format) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/broutes.rb', line 11

def self.from_file(file, format)
  raise "unable to interpret format #{format}" unless processor = Formats::Factory.new.get(format)
  Broutes.logger.debug {"found processor #{processor} for #{file}"}
  route = GeoRoute.new
  processor.load(file, route)
  route
end