~mil/mobroute

438d7454aa61ef6c6118dfd55e5d290ace44ebb2 — Miles Alan 2 months ago 13eb3b5
Cleanup CLI doc further
1 files changed, 20 insertions(+), 32 deletions(-)

M doc/userguide_cli.md
M doc/userguide_cli.md => doc/userguide_cli.md +20 -32
@@ 21,38 21,26 @@ Go codebase and then running routing requests locally.
  - [Mobroute: Finding GTFS Feeds](https://git.sr.ht/~mil/mobroute/tree/master/doc/doc_gtfsfeeds.md)
  - [Mobroute: Algorithm Tunable Parameters](https://git.sr.ht/~mil/mobroute/tree/master/doc/doc_tunables.md)

## **Mobroute CLI: Install & Running Custom Routing Requests**

- (1) Installation assumes Go (>=1.18)
- (2) Clone the Mobroute repository:
  - `git clone http://git.sr.ht/~mil/mobroute`
- (3) Build the Mobroute binary:
  - `./build.sh`



- (4) Run your routing request by passing the request as JSON:
  - ```sh
./mobroute route -rp '{
  "route_params": {
    "feed_ids": [516],
    "from": [40.70940, -74.00537],
    "to": [40.72879, -73.95215],
    "transfer_categories": ["f", "i"],
    "output_formats": ["legs", "mapurl"]
  }
}'
    ```
- (5) The route response is JSON:
  - See an [example output response here](http://ci.lrdu.org/tests_results/json/516.json)
  - The properties of `legs` and `mapurl` are included as those are the `output_formats`
    specified in the request
  - The `legs` format:
    - Shows the calculated route formatted into steps the user can take to accomplish the route
    - E.g. (board train x at y time etc.; transfer here or there in a more verbose format).
  - The `mapurl` format:
    - The route is converted to GeoJSON and displayed as a URL link to a [web geojson rendering service](http://geojson.lrdu.org))
    - See [an example of a route map format rendering here](http://geojson.lrdu.org/#%5B%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22walk%22%2C%22name%22%3A%22Walk+from+origin+%2840.7094%2C+-74.0054%29%3A+21%3A22%3A20+%E2%86%92+21%3A26+%283m+40s%29%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-74.0054%2C40.7094%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22board%22%2C%22name%22%3A%22Board+trip+%28A+toward+Ozone+Park-Lefferts+Blvd%29%3A+21%3A26+%E2%86%92+21%3A32%3A30+%286m+30s%29%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-74.0077%2C40.7102%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28High+St%29+at+21%3A29%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9905%2C40.6993%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Jay+St-MetroTech%29+at+21%3A31%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9873%2C40.6923%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Hoyt-Schermerhorn+Sts%29+at+21%3A32%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.985%2C40.6885%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22board%22%2C%22name%22%3A%22Transfer%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.985%2C40.6885%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22board%22%2C%22name%22%3A%22Board+trip+%28G+toward+Court+Sq%29%3A+21%3A37+%E2%86%92+21%3A51%3A30+%2814m+30s%29%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.985%2C40.6885%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Fulton+St%29+at+21%3A38%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9754%2C40.6871%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Clinton-Washington+Avs%29+at+21%3A40%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9668%2C40.6881%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Classon+Av%29+at+21%3A41%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9601%2C40.6889%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Bedford-Nostrand+Avs%29+at+21%3A42%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9535%2C40.6896%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Myrtle-Willoughby+Avs%29+at+21%3A44%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.949%2C40.6946%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Flushing+Av%29+at+21%3A45%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9502%2C40.7004%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Broadway%29+at+21%3A46%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9503%2C40.7061%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Metropolitan+Av%29+at+21%3A48%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9514%2C40.7128%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Nassau+Av%29+at+21%3A50%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9513%2C40.7246%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22stop%22%2C%22name%22%3A%22Trip+stop+%28Greenpoint+Av%29+at+21%3A51%3A30%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9544%2C40.7314%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22icon%22%3A%22walk%22%2C%22name%22%3A%22Walk+to+destination+%2840.7288%2C+-73.9522%29%3A+21%3A51%3A30+%E2%86%92+21%3A57%3A24+%285m+54s%29%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B-73.9522%2C40.7288%5D%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22name%22%3A%22Route%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22LineString%22%2C%22coordinates%22%3A%5B%5B-74.0054%2C40.7094%5D%2C%5B-74.0077%2C40.7102%5D%2C%5B-74.0077%2C40.7102%5D%2C%5B-74.0077%2C40.7102%5D%2C%5B-73.9905%2C40.6993%5D%2C%5B-73.9873%2C40.6923%5D%2C%5B-73.985%2C40.6885%5D%2C%5B-73.985%2C40.6885%5D%2C%5B-73.985%2C40.6885%5D%2C%5B-73.985%2C40.6885%5D%2C%5B-73.985%2C40.6885%5D%2C%5B-73.985%2C40.6885%5D%2C%5B-73.9754%2C40.6871%5D%2C%5B-73.9668%2C40.6881%5D%2C%5B-73.9601%2C40.6889%5D%2C%5B-73.9535%2C40.6896%5D%2C%5B-73.949%2C40.6946%5D%2C%5B-73.9502%2C40.7004%5D%2C%5B-73.9503%2C40.7061%5D%2C%5B-73.9514%2C40.7128%5D%2C%5B-73.9513%2C40.7246%5D%2C%5B-73.9544%2C40.7314%5D%2C%5B-73.9544%2C40.7314%5D%2C%5B-73.9544%2C40.7314%5D%2C%5B-73.9522%2C40.7288%5D%5D%7D%7D%5D)
## **Mobroute CLI: Install**

- Install via package:
  - On some distrobutions the Mobroute CLI has been packaged, if available
    this is the simplest installation method.
  - Distrobution packages:
    - Alpine Linux Testing: `apk add mobroute`


- Install from source:
  - If a package is not avilabale for your distrobution, building from source
    is simple using Go
  - Steps:
    - (1) Installation assumes Go (>=1.18)
    - (2) Clone the Mobroute repository:
      - `git clone http://git.sr.ht/~mil/mobroute`
    - (3) Build the `mobroute` binary:
      - `./build.sh`
    - (4) Install as:
      - `cp mobroute /usr/bin/`

## **Mobroute CLI: Route subcommand**