# gps-simulator

> A js lib to simulate GPS location of a movable object (bus, car, etc).

Latest version **1.1.1** (published 2016-08-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install gps-simulator
pnpm add gps-simulator
yarn add gps-simulator
bun add gps-simulator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2016-08-10 |
| First published | 2016-08-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | FPT-Software |
| Maintainers | nvt2106 |
| Keywords | gps, simulator, bus |

## Links

- npm: https://www.npmjs.com/package/gps-simulator
- Repository: https://github.com/fpt-software/GPS-Simulator
- Homepage: https://github.com/fpt-software/GPS-Simulator#readme
- Issues: https://github.com/fpt-software/GPS-Simulator/issues
- npm.io page: https://npm.io/package/gps-simulator

## Dependencies (1)

- [geodesy](https://npm.io/package/geodesy.md) ^1.1.0

## Recent versions

- 1.1.1 (latest) — 2016-08-10
- 1.1.0 — 2016-08-10
- 1.0.4 — 2016-08-10
- 1.0.3 — 2016-08-05
- 1.0.2 — 2016-08-04
- 1.0.1 — 2016-08-04

## README

GPS Simulator
====================


Install
-------

    npm install gps-simulator


Usage
-----
	var gps = require('gps-simulator/gps-simulator.js');
	var gpsData = require('gps-simulator/gps-simulator-data.js');

	// There are 4 routes in gpsData, named routes01 -> routes04
	// Each route, there are 2 directions: AB and BA
	// So to get one route data, just use: gpsData.routes01.AB, for example.
	
	var busId = 'Bus 01';

	var gpsSimulator = new gps.GpsSimulator(gpsData.routes01.AB, busId);
	
	gpsSimulator.start(function(position, beStopped, movableObject, currentRouteIndex) {
		var str = "Route " + currentRouteIndex + ", speed " + movableObject.velocity * 3.6 + " km/h";
		console.log('[ ' + new Date() + ' ] ' + str);
		
		var gps_sensor = {
			"device_id" : busId,
			"timestamp" : new Date(),
			"latitude" : position.latitude,
			"longitude" : position.longitude
		};

		// Do something you want with gps_sensor
		
		if (beStopped == true) {
			console.log(busId + ' has been stopped');
			console.log('======================================');
		}
	});

---
_Source: https://npm.io/package/gps-simulator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
