Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikaello/gpxfaketimer
Create fake timestamps for GPX-files. Useful for debugging or creating anonymized tracks
https://github.com/mikaello/gpxfaketimer
Last synced: 3 months ago
JSON representation
Create fake timestamps for GPX-files. Useful for debugging or creating anonymized tracks
- Host: GitHub
- URL: https://github.com/mikaello/gpxfaketimer
- Owner: mikaello
- License: gpl-3.0
- Created: 2020-05-03T14:43:16.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-10T09:14:48.000Z (10 months ago)
- Last Synced: 2024-04-14T12:56:00.058Z (9 months ago)
- Language: TypeScript
- Homepage: https://gpxfaketimer.now.sh
- Size: 576 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GPX fake timer
[![npm](https://img.shields.io/npm/v/@mikaello/gpxfaketimer.svg?style=flat-square)](https://www.npmjs.com/package/@mikaello/gpxfaketimer)
Create timestamps for every trackpoint in a GPX file.
```shell
yarn add @mikaello/gpxfaketimer
```## Example
```ts
import { createTimestampsEvenly } from "@mikaello/gpxfaketimer";const exampleGpx = `
Example gpx
Example gpx
1
2376
2375
2376
`;
console.log(createTimestampsEvenly(exampleGpx, 0, 100000));
// => will return the same GPX file, only with inside every trkpt:/*
Example gpx
Example gpx
1
2376
2375
2376
*/
```## API
- _`createTimestampsEvenly(gpxContent: string, startTime: number, endTime: number) => string`_:
returns the incoming `gpxContent` enriched with timestamps in every `trkpt`
element. `startTime` and `endTime` are milliseconds since epoch.## Utility functions
Not specific for GPX, but just as helper functions
_`getUniformDistribution(count: number, intervalStart: number, intervalEnd: number) => number[]`_:
returns an array of length `count` with first element `intervalStart` and last
element `intervalEnd`, all elements in between is evenly distributed between
these extremeties.## Develop
You can use the [./example](./example) project to ease developing. If you run
`yarn start` from that folder, you will start a server running a small
application which loads the code from this module. Run `yarn dev` in another
terminal to start to continously watch the code and recompile (and reload
server) when any code changes.Contributions are welcome :-)