geo_point

A GeoPoint encapsulates latitude, longitude and various geo calculations relative to itself

MIT License

Downloads
693K
Stars
5
Committers
2

h1. Geo Point

Adds the concept of a GeoPoint for geo libraries. A GeoPoint encapsulates latitude and longitude, and:

  • a coordinates mode (coord_mode) that can be set to either :lng_lat or :lat_lng
  • calculations such as: distance_to, bearing_to, midpoint, intersection and destination point
  • parsing from various String, Hash or Array formats, including from DMS string format, such as "58 38 38N, 003 04 12W"

Using GeoPoints makes it much easier and more efficient to transport location point data and various geo libraries adds additional functionality such as vector operations on top (see fx "geo_vectors":https://github.com/kristianmandrup/geo_vectors gem). Enjoy!

h2. Install

Gemfile:

@gem 'geo_point'@

$ bundle

h2. Status Sept 2012

Currently a few of the specs break. Please help Fix. They might be related to geo_calc and/or geo_units gems.

h2. Quick start (Usage)

First define the points on the globe you want to work with. The GeoPoint initializer is very flexible with regards to the arguments it can handle.

h2. Utility methods

These are some of the utility methods you can use on a GeoPoint object

h2. Global configuration options

h2. GeoPoint functionality

A GeoPoint always has the following calculation API available:

  • bearing_to(point)
  • final_bearing_to(point)
  • destination_point(brng, dist)
  • distance_to(point)
  • intersection_point(brng1, p2, brng2)
  • midpoint_to(point)

Rhumb: (see "Rhumb_line":http://en.wikipedia.org/wiki/Rhumb_line)

  • rhumb_distance_to(point)
  • rhumb_bearing_to(point)
  • rhumb_destination_point(brng, dist)

See the "geo_calc":https://github.com/kristianmandrup/geo_calc gem for details on how to use this Api

h2. Contributing to geo_point

  • 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.