Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: typos

...

This approach uses HTTP POST capability of RouterOS Fetch tool. It allows you to POST any kind of data to a webserver, right from the RouterOS command line. Of course, you can use scripting, to fill the POST data with variables. The posted data will be written to an SQLITE3 database (file is created, if it doesn't exist) and then, read from the database and fead fed into a Leaflet.js PolyLine array. This is a proof of concept example, there is no authentication, security, or error handling.

Requirements

  • Webserver Web server of your choice
  • PHP
  • SQLite3 module for PHP
  • RouterOS device with a working GPS module
  • RouterOS v6.40rc30 or above
  • Set GPS format in RouterOS to dd

...

You can run this script in the Scheduler tool, with an interval of 1s, to have your coordinates sent every 1 secondssecond.

Code Block
languageros
{
:global lat
:global lon
/system gps monitor once do={
:set $lat $("latitude")
:set $lon $("longitude")
}
tool fetch mode=http url="http://YOURSERVER.com/index.php" port=80 http-method=post http-data=("{\"lat\":\"" . $lat . "\",\"lon\":\"" . $lon . "\"}") http-header-field="Content-Type: application/json" 
:put ("{\"lat\":\"" . $lat . "\",\"lon\":\"" . $lon . "\"}")
}

...