aboutsummaryrefslogtreecommitdiff
path: root/tools/test-generator.py
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-03 15:52:39 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-03 15:54:45 -0700
commitc49bda5396847731f4eea8f6e3f0e0dd6811ae6f (patch)
tree49458a518577936d367dc6a87b02cabc6f42e025 /tools/test-generator.py
parent5f88528350f55802d63bfcb0f4902a4a3399634c (diff)
downloadtrackermap-server-c49bda5396847731f4eea8f6e3f0e0dd6811ae6f.tar.gz
trackermap-server-c49bda5396847731f4eea8f6e3f0e0dd6811ae6f.tar.bz2
trackermap-server-c49bda5396847731f4eea8f6e3f0e0dd6811ae6f.zip
Support KML export (fix #1858, fix #2329)
Diffstat (limited to 'tools/test-generator.py')
-rwxr-xr-xtools/test-generator.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/test-generator.py b/tools/test-generator.py
index b8a06ac32..eb50d2600 100755
--- a/tools/test-generator.py
+++ b/tools/test-generator.py
@@ -35,8 +35,8 @@ for i in range(0, len(waypoints)):
lon = lon1 + (lon2 - lon1) * j / count
points.append((lat, lon))
-def send(conn, lat, lon, course, speed, battery, alarm, ignition, accuracy, rpm, fuel, driverUniqueId):
- params = (('id', id), ('timestamp', int(time.time())), ('lat', lat), ('lon', lon), ('bearing', course), ('speed', speed), ('batt', battery))
+def send(conn, lat, lon, altitude, course, speed, battery, alarm, ignition, accuracy, rpm, fuel, driverUniqueId):
+ params = (('id', id), ('timestamp', int(time.time())), ('lat', lat), ('lon', lon), ('altitude', altitude), ('bearing', course), ('speed', speed), ('batt', battery))
if alarm:
params = params + (('alarm', 'sos'),)
if ignition:
@@ -70,6 +70,7 @@ conn = httplib.HTTPConnection(server)
while True:
(lat1, lon1) = points[index % len(points)]
(lat2, lon2) = points[(index + 1) % len(points)]
+ altitude = 50
speed = device_speed if (index % len(points)) != 0 else 0
alarm = (index % 10) == 0
battery = random.randint(0, 100)
@@ -78,6 +79,6 @@ while True:
rpm = random.randint(500, 4000)
fuel = random.randint(0, 80)
driverUniqueId = driver_id if (index % len(points)) == 0 else False
- send(conn, lat1, lon1, course(lat1, lon1, lat2, lon2), speed, battery, alarm, ignition, accuracy, rpm, fuel, driverUniqueId)
+ send(conn, lat1, lon1, altitude, course(lat1, lon1, lat2, lon2), speed, battery, alarm, ignition, accuracy, rpm, fuel, driverUniqueId)
time.sleep(period)
index += 1