Class: RClusters::SurfaceDistance

Inherits:
Base
  • Object
show all
Defined in:
lib/rclusters/surface_distance.rb

Instance Method Summary collapse

Methods inherited from Base

#calculate, #initialize

Constructor Details

This class inherits a constructor from RClusters::Base

Instance Method Details

#distance(lat1, lon1, lat2, lon2, opts = {}) ⇒ Object



6
7
8
9
10
11
# File 'lib/rclusters/surface_distance.rb', line 6

def distance(lat1,lon1,lat2,lon2,opts={})
  Geokit::default_units = opts[:default_units] || :meters
  Geokit::default_formula = opts[:default_formula] || :sphere

  Geokit::LatLng.new(lat1,lon1).distance_to(Geokit::LatLng.new(lat2,lon2))
end