Topic: Generating messages layer with python
Hello guys. I need some help creating messages layer for downloading history period of units. I have this code, works ok getting the units list, but i get this error "WialonError(Invalid input render_create_messages_layer (4))" from the render_create_messages_layer. Any advice? Thanks
from wialon.api import Wialon, WialonError
from wialon import flags
import json
starttime = "1478736000"
endtime = "1479600000"
try:
wialon_api = Wialon()
result = wialon_api.token_login(token='token')
wialon_api.sid = result['eid']
result = wialon_api.avl_evts()
print result
spec = {
'itemsType': 'avl_unit',
'propName': 'sys_name',
'propValueMask': '*',
'sortType': 'sys_name'
}
interval = {"from": 0, "to": 0}
try:
units = wialon_api.core_search_items(spec=spec, force=1, flags=flags.ITEM_DATAFLAG_BASE, **interval)
for i in units['items']:
gen = {
'layerName': 'arhivamesaje',
'itemId': i['id'],
'timeFrom': starttime,
'timeTo': endtime,
'tripDetector': 0,
'trackColor': 'cc713cff',
'trackWidth':5,
'arrows':1,
'points':1,
'pointColor':0,
'annotations':1,
'flags':0
}
print i['nm']
try:
meslayer = wialon_api.render_create_messages_layer(spec=gen)
except WialonError as e:
print e
except WialonError as e:
print e
wialon_api.core_logout()
except WialonError as e:
pass