You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
3.0 KiB

7 years ago
  1. # Compass
  2. Compass is a GPS tracking server that stores data in [flat files](https://github.com/aaronpk/QuartzDB).
  3. ## Setup
  4. In the `compass` directory, copy `.env.example` to `.env` and fill in the details. Install the dependencies with composer.
  5. ## API
  6. After you create a tracking database, you can visit the database's settings page to get a read or write token. These tokens are used with the API to update or retrieve data.
  7. ### Writing
  8. To write to a database, make a POST request in JSON format with the following keys:
  9. `POST /api/input`
  10. * locations - a list of GeoJSON objects
  11. * token - the write token for the database
  12. The GeoJSON objects must have at least one property, "timestamp", which is can be any value that can be interpreted as a date. The object can have any additional properties you wish.
  13. The open source iOS [GPS Logger](https://github.com/esripdx/GPS-Logger-iOS) will send data in this format by default.
  14. ### Reading
  15. To read a database, make a GET request as follows:
  16. `GET /api/query`
  17. * token - (required) the read token for the database
  18. * tz - (optional, default UTC) timezone string (e.g. America/Los_Angeles) which will be used to determine the absolute start/end times for the day
  19. * format - (optional, default "full") either "full" or "linestring"
  20. * full - return one JSON record for each result in the database
  21. * linestring - combine all the returned results into a GeoJSON linestring
  22. * date - specify a date to return all data on that day (YYYY-mm-dd format)
  23. `GET /api/last`
  24. * token - (required) the read token for the database
  25. * tz - (optional, default UTC) timezone string (e.g. America/Los_Angeles) which will be used to determine the absolute start/end times for the day
  26. * before - (optional, default to now) specify a full timestamp to return a single record before this date (the point returned will be no more than 24 hours before the given date)
  27. * geocode - (optional) if "true", then the location found will be reverse geocoded using [Atlas](https://atlas.p3k.io) to find the city and timezone at the location
  28. `GET /api/find-from-localtime`
  29. This API method can help you answer the question "Where was I when my watch read 9:30am on July 15th?".
  30. Timestamps in Exif data do not include the timezone offset, and there is no standard mechanism for including the timezone offset in Exif. Some Canon cameras put the offset in a field, but not all of them do. You can use this method to find your location given an Exif date.
  31. * token - (required) the read token for the database
  32. * input - specify a clock time in the format `YYYY-mm-dd HH:MM:SS`
  33. This will query the database and find the closest matching location for when your clock read that time.
  34. ## Credits
  35. Compass icon by Ryan Spiering from the Noun Project.
  36. ## License
  37. Copyright 2015 by Aaron Parecki
  38. Compass is licensed under the [Apache 2.0 license](http://opensource.org/licenses/Apache-2.0)
  39. Compass is built using the Lumen framework, which is licensed under the [MIT license](http://opensource.org/licenses/MIT)