Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianmandrup committed May 12, 2011
1 parent 42ff020 commit c217f33
Show file tree
Hide file tree
Showing 16 changed files with 1,203 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -4,6 +4,9 @@ coverage
# rdoc generated
rdoc

# Gemfile
*.lock

# yard generated
doc
.yardoc
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -6,7 +6,7 @@ source "http://rubygems.org"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rspec", "~> 2.3.0"
gem "rspec", ">= 2.3.0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.2"
gem "rcov", ">= 0"
Expand Down
19 changes: 0 additions & 19 deletions README.rdoc

This file was deleted.

68 changes: 68 additions & 0 deletions README.textile
@@ -0,0 +1,68 @@
h1. Geo calculations

Geo Calculation library. Useful functions to add to your geo arsenal, fx when designing your own Geo library (gem).

h2. Install

require 'geo_calc'

h3. Rails 3

In Gemfile:

@gem 'geo_calc'@

From command line, run bundler

@$ bundle@

h2. Status (May 12, 2011)

Not yet tested (POC)

h2. Quick start (Usage)

<pre>
p1 = GeoPoint.new 51.5136, -0.0983
p2 = GeoPoint.new(51.4778, -0.0015

dist = p1.distance_to(p2) # in km

brng = p1.bearing_to(p2) # in degrees clockwise from north

final_brng = p1.final_bearing_to(p2) # final bearing in degrees from north

mid = p1.midpoint_to point(p2) # midpoint between p1 and p2

dest = p1.destination_point bearing, dist # Bearing in degrees, Distance in km

GeoPoint.intersection p1, brng1, p2, brng2 # intersection between two paths

p1.rhumb_distance_to(p2)

p1.bearing_to(p2)

p1.rhumb_destination_point(brng, dist)

p1.lat # latitude
p2.lon # longitude
p1.to_s # string rep
</pre>

The libary also comes wih a javascript file with the same functionality. See _js/geo_calc.js_ in the _/lib_ folder

h2. Contributing to geo_calc

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

h2. Copyright

Copyright (c) 2011 Kristian Mandrup. See LICENSE.txt for
further details.

4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -15,8 +15,8 @@ Jeweler::Tasks.new do |gem|
gem.name = "geo_calc"
gem.homepage = "http://github.com/kristianmandrup/geo_calc"
gem.license = "MIT"
gem.summary = %Q{TODO: one-line summary of your gem}
gem.description = %Q{TODO: longer description of your gem}
gem.summary = %Q{Geo calculation library}
gem.description = %Q{Geo calculations in ruby and javascript}
gem.email = "kmandrup@gmail.com"
gem.authors = ["Kristian Mandrup"]
# Include your dependencies below. Runtime dependencies are required when using your gem,
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.0.0
0.1.0
1 change: 1 addition & 0 deletions lib/geo_calc.rb
@@ -0,0 +1 @@
require 'geo_calc/geo_point'

0 comments on commit c217f33

Please sign in to comment.