Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tracker

A simple REST interface for uploading and viewing GPS coordinates. To be used in conjunction with a client app.

##How to use

  1. Download ZIP file for this project and copy it to a directory on your website e.g. www.example.org/mytracker
  2. Open the resources/constants.php file in a text editor and customise the following constants, the majority of them can be left as their default values but it's worth checking: * GOOGLE_MAPS_API - Add your Google Maps API key * MAX_DEVICES - Maximum number of devices, use -1 for unlimited devices (default: -1) * SPEED_MODE - Tells the system whether to show speeds for cyclists, runners or both. (default: both) * DEV_MODE - Enables developer options such as viewing the SQLite tables and constants, if you're not a developer leave this mode off (default: false) * GOOGLE_ANALYTICS_TRACKING_ID - Google Analytics Tracking ID (optional) (default: none set)
  3. Use an app on your phone to periodically upload the users location.
  4. The first call should be to http://www.example.org/mytracker/api/v1/init/dl (where dl is the download key that will be used to access view the tracking points) with the following POST parameters: * reset - 1 to clear the previous GPS coordinates. 0 to keep them * device - a unique, secret, ID for the device.
  5. Initializing will create the SQLite database and generate an upload key used to add GPS coordinates to the database. The response will be a JSON string in the following format: {"success":true,"key":"DtBFiyiwvH62YfZ","device":"abc123"}
  6. The JSON string contains three fields: * success - true if the initialisation was a success * key - The key to be used to upload GPS coordinates. The system will generate a key regardless of success so always check success before using the key * device - The device ID which was originally given
  7. After successful initialisation coordinates can be uploaded by accessing http://www.example.org/mytracker/api/v1/update/ul (where ul is the upload key that is used to add coordinates to the database) with the following POST parameters: * lat - The latitude value * long - The longditude value * dt - The timestamp for the coordinates (in milliseconds since midnight 1 January 1970) * speed (optional) - The speed value (in m/s) * alt (optional) - The altitude (in m)
  8. The response to this will be a JSON string in the following format: {"response":true,"date_time":"1430425590477"}
  9. The JSON string contains three fields: * response - true if the upload was successful * date_time - the timestamp provided when the upload was sent - allows you to match a response to a given upload request
  10. Repeat 2.4 - 2.6 periodically to provide live tracking
  11. Details of your position can be viewed by accessing http://www.example.org/mytracker/track/download where download is the download key set in step 2.1.
  12. GPX files can be downloaded for each route by accessing http://www.example.org/mytracker/track/download.gpx where download is the download key set in step 2.1.

About

A simple REST interface for uploading and viewing GPS coordinates. To be used in conjunction with a client app.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages