Pointy
Uses Google Directions API to get a list of points between two locations.
Installation
Add this line to your application's Gemfile:
gem 'pointy'And then execute:
$ bundle
Or install it yourself as:
$ gem install pointy
Usage
-
Set the environment variable
GOOGLE_DIRECTIONS_API_KEYto your Google Directions API key. -
Use the route method to retrieve points between two locations.
Pointy.route(from, to)
from and to should be hashes of the following format
{
lat: 55.8580,
long: -4.2590
}
The returned array of points are of the same format. If you would rather an
array of
polylines then call Pointy.route_polylines(from, to) instead.
You can also pass in any other query parameters accepted by Google, so you override the API key or transport mode
Pointy.route(from, to, {key: 'my-api-key', mode: 'walking'})
The mode defaults to 'walking' and sensor defaults to false.
Contributing
- Fork it ( https://github.com/addjam/pointy/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request