Skip to content

Commit

Permalink
add DISTANCE_UNITS
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Apr 11, 2024
1 parent 4fdd17c commit c9f4ae9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
27 changes: 27 additions & 0 deletions spec/geo_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require "./spec_helper"

describe Geo do
context "DISTANCE_UNITS" do
it do
distance_units = {
:centimeters,
:centimetres,
:degrees,
:feet,
:inches,
:kilometers,
:kilometres,
:meters,
:metres,
:miles,
:millimeters,
:millimetres,
:nautical_miles,
:radians,
:yards,
}

Geo::DISTANCE_UNITS.should eq(distance_units)
end
end
end
4 changes: 4 additions & 0 deletions src/geo.cr
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
require "convex_hull"
require "geohash"
require "geo_bearing"
require "haversine"
require "./geo/utils"
require "./geo/coord"
require "./geo/polygon"
require "./geo/distance"

module Geo
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}

DISTANCE_UNITS = Haversine::FACTORS.keys
end
2 changes: 0 additions & 2 deletions src/geo/distance.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "haversine"

module Geo
struct Coord
# Calculates distance to `other`.
Expand Down

0 comments on commit c9f4ae9

Please sign in to comment.