Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chiditarod/cartographer
Ruby on Rails app to find viable routes for the CHIditarod
https://github.com/chiditarod/cartographer
Last synced: about 1 month ago
JSON representation
Ruby on Rails app to find viable routes for the CHIditarod
- Host: GitHub
- URL: https://github.com/chiditarod/cartographer
- Owner: chiditarod
- License: gpl-3.0
- Created: 2018-12-02T01:42:56.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T17:38:36.000Z (almost 2 years ago)
- Last Synced: 2024-05-10T22:01:52.350Z (8 months ago)
- Language: Ruby
- Homepage: http://chiditarod.org
- Size: 695 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cartographer
Ruby on Rails app that finds viable routes for the CHIditarod, based on
customizable criteria like leg length, overall race length, etc.[![Build Status](https://travis-ci.com/chiditarod/cartographer.svg?branch=master)](https://travis-ci.com/chiditarod/cartographer) [![Maintainability](https://api.codeclimate.com/v1/badges/0f8b7b85f89b0024665a/maintainability)](https://codeclimate.com/github/chiditarod/cartographer/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/0f8b7b85f89b0024665a/test_coverage)](https://codeclimate.com/github/chiditarod/cartographer/test_coverage)
## Google API Setup
Your Google Cloud Platform account and associated [API key](https://console.cloud.google.com/apis/credentials) must have access to the following APIs:
- [Distance Matrix API](https://developers.google.com/maps/documentation/distance-matrix/intro)
- [Geocoding API](https://developers.google.com/maps/documentation/geocoding/start)
- [Static Maps API](https://developers.google.com/maps/documentation/maps-static/intro)## Runtime Environment
| Variable Name | Purpose |
| ---- | ------- |
| `GOOGLE_API_KEY` | Google Cloud Platform API key with access to the APIs listed above. |
| `MOCK_MAP` | When `true` load a fake route map instead of querying the Google Static API. |## Example Usage
### Seed
```bash
bundle exec rake db:seed
GOOGLE_API_KEY=... bundle exec rails c
```### Generate all Legs using Google Maps API
```ruby
BulkLegCreator.perform_now(Location.pluck(:id))
```### Generate Routes
```ruby
RouteGenerator.call(Race.first)
winners = Route.complete
puts winners.map(&:to_csv)
puts winners.map(&:to_s)selected = winners.select{|r| r.name != nil}
selected.map(&:to_csv)
```### Geocode Locations using Google Maps API
```ruby
GeocodeLocationJob.perform_now(Location.pluck(:id))
```### Clean things up
```ruby
Race.destroy_all; Route.destroy_all; Leg.destroy_all; Location.destroy_all; Leg.destroy_all; nil
```## Developer Setup
*Tested using OSX Mojave 10.14.2*.
Prerequisites
- [Xcode](https://itunes.apple.com/us/app/xcode/id497799835),
[Docker](https://www.docker.com), [Homebrew](https://brew.sh/)Install rbenv & Ruby
```bash
brew install rbenv
rbenv install $(cat .ruby-version)
gem install bundler
```Install Gems
```bash
brew install libffi libpqbundle config --local build.ffi --with-ldflags="-L/usr/local/opt/libffi/lib"
bundle config --local build.pg --with-opt-dir="/usr/local/opt/libpq"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libffi/lib/pkgconfig"bundle install
```