LtAP Mini GPS + tracking in map

Anybody already has done this?

I am new to this but have no clue on how to get me a map that tell me where my LtAP mini with external GPS antenna (so it all works!) is.

The wiki show some info but now I have to go into scripting, installing server(s), etc…

A ‘how to’ for dummies would be appreciated…

Ummm, but you WILL have to do that. There is no easier way, you can’t have a webpage with a moving map, if you don’t have a web server :slight_smile:

https://wiki.mikrotik.com/wiki/Manual:GPS-tracking

Yes ok, but now I first have to investigate what server is best… any recommendations? You guys made screendump of a map in the Wiki example. A dummy (in this respect!) could start with the same…? I have no problems installing a webserver. But which one is good? No clue…

nginx+php on any hosting provider. digitalocean is simple. for test purposes, you can have it on your desktop with https://www.wamp.net

Normis, is there a specific command in RouterOS to change the GPS format type? Or, is the only way to get dd GPS data through the “system gps monitor format=dd command”?

Also, using the scripts from https://wiki.mikrotik.com/wiki/Manual:GPS-tracking, it does not post lat/long data to the sqlite database. I get data in the db for “time” and “added” but do not get lat/long data. I noticed in the PHP script for index,php, the data values are “TEXT”. Does leafy require text values? I would think you would want to use “FLOAT”. Tried all parameters (NUMERIC, INTEGER) etc. Just cant get lat/long info into sqlite3.

My server is set up with apache2, PHP and sqlite. All work with other tests I’ve done. Im suspecting the router isn’t actually putting the lat long data in to be processed via json.

Any help would be great.. Thanks!

Latest RouterOS versions have some changes in the GPS commands. The next Beta will have “set” instead of “monitor” for the format, so the wiki script will work then. We updated article before version was released, sorry about that. Probably today or tomorrow it will be out.

Since the new version supports DD format, the example has gotten easier.

Thanks Normis. Im looking forward to getting the updated OS and get this working. I will eventually get this working with postgresql. I’ll update you with that code once I get it stitched together.

Again.. thanks for your help..

Hello Normis – I installed 6.44beta61. I used the set command for dd. Still doesn’t work BUT, I did find an issue. I sniffed and pulled apart the traffic going to JSON.. So we get prepended \00\00\00\00\00\00 etc.. trailing our dd lat/lon values.. I found a match to the value in “system script environment”..

[admin@Client_101] /system script environment> pri

NAME VALUE

0 lat 33.9686\00\00\00\00\00\00\00\00\00\00\00
1 lon -117.7433\00\00\00\00\00\00\00\00\00\00\0
[admin@Client_101] /system script environment>

Basically JSON just chokes on the string the global variable represents.. This (I believe) may be an issue..

Just a thought, I could be misunderstanding the reason for the \00\00\00…

I’ll naturalize (remove the \00\00...etc) the string in pyhton and spit it into the sqlite db..

Hope this helps.. And again thanks for your time..

Which script did you use, which caused these added zeroes?

Hi Normis,

The output isn’t from a script it’s the “/system script environment print” command in RouterOS. There is a PHP filter for the index.php script that filters the zeros and "" forward slashes out before it goes to the JSON app. I got it working. I had to do a couple of tweeks.. one of which was getting the PHP script for index.php to understand negative numbers. You have to include the “-?” in the PHP preg_match line like here:

if (preg_match(‘/^-?[([0-9]{2,3}.[0-9]{0,8})$/’,$data->lat) && preg_match(‘/^-?([0-9]{2,3}.[0-9]{0,8})$/’,$data->lon) )

Note.. after the carot, you need a “-?” before the brackets. You should include this in your script online to help users South of the equator where they have negative lats and in North America where we have negative longs. If both lat and long do not have this in the preg_match line, neither lats nor longs will get into the DB.

I’m going to migrate to a Postgresql DB.. When I do, I’ll provide you with another index.php script with more features in the DB.. ie.. Router ID, speed etc.

Thanks for your time..

Cheers!

We improved the regex, to support negative coords

Hi, does someone know how to solve the problem of the 00 in the latitude and longitude reading of router OS ? I have this problem on Router OS v.6.44rc1 when i set gps format do DD.
The tracking works well, but with wrong coordinates value device location is not correct. Any idea to get this issue solved ?

here is a screenshot
GPS.PNG

I would also be interested in this …

I’m glad I am not the only one to discover the extra 00 in the coordinates bug when coordinates format is set to dd

To clarify for anyone who has pull to get this fixed-

There are two extra 0s prepended to the portion of the coordinates to the right of the decimal place. This occurs for both latitude and longitude.
Example: If you are located at 40.123456, -120.789123, the device reports your coordinates as 40.001234, -120.007891.

The issue has been fixed with the additional “\00” values at the end of the output and will be released on all three branches with the next releases.



This should be fixed too, if you still encounter the issue, please write an e-mail to support@mikrotik.com providing Supout.rif file of your device generated when you experience the issue.

please consider to change the regex to : /^(|-)([0-9]{1,3}.[0-9]{0,8})$/
in fact here in Germany we have only one digit in Longitude
.. Costs me 1h debugging … but now i know regex better :wink:

Not sure whether you are still looking but this should be helpful. Also included a guide on Github for the server configuration.
https://scoop.co.za/blog/post/vehicle-gps-tracking-with-mikrotik-s-ltap

Hey guys,

Been trying to get the GPS to work however I’m not sure what is causing this, hopefully someone has had this issue and fixed it already.

Hardware: 2HnD&R11e-LTE + External ACGPSA antenna (antenna has LOS to the sky)
Software: 6.45.7

GPS results: -1036.-336429655, -4858.13775277, 581543.000000m ← not valid GPS co-ords

/port print
Flags: I - inactive

DEVICE NAME CHANNELS USED-BY BAUD-RATE

0 serial0 1 auto
1 serial1 1 GPS auto

/system gps print
enabled: yes
port: serial1
channel: 0
init-string:
set-system-time: no
coordinate-format: dd
gps-antenna-select: external

notes: When doing gps logging when using serial0 I get no logs, however when I use serial1 I get results

Thanks

Serial0 is a console port, you need to use Serial1.

Cool at least I know I’m using the GPS modem on the correct port.

And this is the weird GPS data I am receiving after hours of being online:

/system gps monitor once
date-and-time: dec/31/1969 23:59:59
latitude: -461.17353055
longitude: -14469.358071283
altitude: -818737.000000m
speed: none
destination-bearing: none
true-bearing: none
magnetic-bearing: none
valid: no
satellites: 0
fix-quality: 0
horizontal-dilution: 42949671.96