Jump to content


Getting Invalid Result with report/get_result_map

get_result_map map png

  • Please log in to reply
No replies to this topic

#1 Guest_DCombes_*

Guest_DCombes_*
  • Guests

Posted 03 January 2018 - 17:43 PM

I am using the PHP/Wialon interface and seeking to generate a map PNG from recent tracker messages and believe I am making the right calls in the right sequence, but am getting an Invalid Result (error:3) from the report/get_result_map call.
 
From a quick scan of my sample code, can someone please advise what I am doing wrong?
 
Many thanks!
<?php
// Login to wialon using token
$result = $wialon_api->login($token);
$json = json_decode($result, true);
$sid = $json['eid'];
// SID returned ok


// get unit ID (only one on account)
$params='{"spec":{"itemsType":"avl_unit","propName":"sys_id","propValueMask":"*","sortType":"sys_id"},"force":1,"flags":1,"from":0,"to":0}';
$result = $wialon_api->call('core_search_items',$params);
$srch_res=json_decode($result);
$unit_id = $srch_res->items[0]->id;
// Unit ID returned ok


// Get 20 recent messages from unit 
$params='{"itemId":'.$unit_id.',"lastTime":0,"lastCount":20,"flags":65281,"flagsMask":0,"loadCount":20}';
$result = $wialon_api->call('messages_load_last',$params);
$msg_data=json_decode($result);
$first_t=$msg_data->messages[0]->t;
// 20 recent messages returned ok, majority with location data


// Clean up report buffer
$params='{}';
$result = $wialon_api->call('report_cleanup_result',$params);
$msg_data=json_decode($result);
// Gives Error:0 = OK


// Create track layer using create_messages_layer
$params='{"layerName":"JoeTracker", "itemId":'.$unit_id.', "timeFrom":'.$first_t.', "timeTo":0, "tripDetector":0, "trackColor":"#0000FF", "trackWidth":5, "arrows":1, "points":1, "pointColor":"#FF0000", "annotations":1, "flags":16}';
$result = $wialon_api->call('render_create_messages_layer',$params);
$msg_data=json_decode($result);
// Result: string(295) "{"name":"JoeTracker","bounds":[51.591087,-0.150262,51.591316,-0.15005],"units":[{"id":14507980,"msgs":{"count":20,"first":{"time":1514997426,"lat":51.5911331177,"lon":-0.150049999356},"last":{"time":1515000138,"lat":51.5912284851,"lon":-0.150261998177}},"mileage":198.178266576,"max_speed":1}]} " 


// Init graphic layer
$params='{"layerName":"JoeTracker","enable":1}';
$result = $wialon_api->call('render_enable_layer',$params);
$msg_data=json_decode($result);
// Gives Enabled:1 = OK


// Get map png
$params='{"width":600,"height":600}';
$result = $wialon_api->call('report_get_result_map',$params);
$msg_data=json_decode($result);
// Gives Error:3 = "Invalid result"
?>

 


  • Charlesdwept and Raymondjic like this





Also tagged with one or more of these keywords: get_result_map, map, png

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users