This is a small app which:
- Regularly pulls the tracking feed from a SPOT Gen3 tracker
- Persists this tracking data to a Mongo database
- Backs up the raw API data to an S3 bucket
- Exposes the tracking data in GeoJSON format for use in a map (I use Mapbox)
- Exposes the tracking data as GPX
- Provides several other utility functions and endpoints
It runs on AWS Lambda using the serverless.js framework.
To get started, pull the repo and run yarn install.
If you want to use it locally, take a look at config.ts for what environment variables need to be set. You may use a .env file.
If you want to deploy it, you'll need to set up AWS auth, and then go through serverless.yml and change all of the things specific to my setup. Then, run sls deploy.
To run tests, run yarn test.
/gpx- exposes the tracking data as GPX- Requires a
fromURL param with an ISO8601 datetime for when the tracking data should start - Optional
toURL param for when the tracking data should stop
- Requires a
/map_data- exposes the tracking data as GeoJSON, optimized for use in a map- Requires a
fromURL param with an ISO8601 datetime for when the tracking data should start - Optional
toURL param for when the tracking data should stop
- Requires a
/map_metadata- exposes some metadata to help rendering the map before loading the tracking data, such as map bounds- Requires a
fromURL param with an ISO8601 datetime for when the tracking data should start - Optional
toURL param for when the tracking data should stop
- Requires a
/one_off_persist- allows adding a single trackpoint to the database "manually." The trackpoint time is assumed to be now.- Requires
latandlonparameters - Requires a
passwordparameter that must match thePERSIST_PASSWORDenv var
- Requires
/realtime_track- A more basic GeoJSON endpoint with just a linestring of the tracking data- Requires a
fromURL param with an ISO8601 datetime for when the tracking data should start - Optional
toURL param for when the tracking data should stop
- Requires a
scheduledPersistSpot- Scheduled lambda function to pull the SPOT API data and persist it