Project

loc

0.01
No commit activity in last 3 years
No release in over 3 years
Location handling & geographical computations
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 9.0
~> 3.5
 Project Readme

Loc

Gem Version CircleCI

Location handling & geographical computations. No external API or DB.

Install

gem install loc

or in Bundler:

gem "loc"

Usage

Location

require "loc"

loc1 = Loc::Location[49.1, 2]

loc1.lat_degrees_per_km
# 0.008993210126354604

loc1.lng_degrees_per_km
# 0.013735635666645289

loc2 = Loc::Location[50, 3]

loc1.distance_to(loc2)
# 123364.76538823603

loc1.bearing_to(loc2)
# 48.01278750418339

LocationCollection

require "loc"

collection = Loc::LocationCollection[[1,2],[3,4]]

collection.distance
# 314402.95102362486

collection[0]
# <Loc::Location {:lat=>1, :lng=>2}>

collection.each { |l| puts l.to_a }
# <Loc::Location {:lat=>1, :lng=>2}>
# <Loc::Location {:lat=>3, :lng=>4}>

collection.map(&:to_a)
# [[1, 2], [3, 4]]

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See the list of contributors who participated in this project.

License

Please see LICENSE