Community discussions

MikroTik App
 
WirelessRudy
Forum Guru
Forum Guru
Topic Author
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

LtAP Mini GPS + tracking in map

Thu Jan 17, 2019 12:45 pm

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....
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Thu Jan 17, 2019 1:23 pm

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 :)

https://wiki.mikrotik.com/wiki/Manual:GPS-tracking
 
WirelessRudy
Forum Guru
Forum Guru
Topic Author
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Re: LtAP Mini GPS + tracking in map

Thu Jan 17, 2019 2:29 pm

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 :)

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...
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Thu Jan 17, 2019 2:30 pm

nginx+php on any hosting provider. digitalocean is simple. for test purposes, you can have it on your desktop with https://www.wamp.net
 
crau1000
just joined
Posts: 6
Joined: Thu Jan 31, 2019 3:52 am

Re: LtAP Mini GPS + tracking in map

Sun Feb 03, 2019 11:10 pm

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!
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Mon Feb 04, 2019 8:48 am

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.
 
crau1000
just joined
Posts: 6
Joined: Thu Jan 31, 2019 3:52 am

Re: LtAP Mini GPS + tracking in map

Mon Feb 04, 2019 11:39 pm

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..
 
crau1000
just joined
Posts: 6
Joined: Thu Jan 31, 2019 3:52 am

Re: LtAP Mini GPS + tracking in map

Tue Feb 05, 2019 2:07 am

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..
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Wed Feb 06, 2019 8:52 am

Which script did you use, which caused these added zeroes?
 
crau1000
just joined
Posts: 6
Joined: Thu Jan 31, 2019 3:52 am

Re: LtAP Mini GPS + tracking in map

Wed Feb 06, 2019 10:01 am

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!
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Wed Feb 06, 2019 10:47 am

We improved the regex, to support negative coords
 
thejokertheory
just joined
Posts: 5
Joined: Wed Feb 20, 2019 3:00 pm

Re: LtAP Mini GPS + tracking in map

Wed Feb 20, 2019 6:50 pm

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
You do not have the required permissions to view the files attached to this post.
 
Tibi
just joined
Posts: 2
Joined: Tue May 31, 2016 9:33 am

Re: LtAP Mini GPS + tracking in map

Mon Feb 25, 2019 5:34 pm

I would also be interested in this ...
 
billessig
just joined
Posts: 1
Joined: Sat Mar 09, 2019 5:41 am

Re: LtAP Mini GPS + tracking in map

Sat Mar 09, 2019 5:52 am

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.
 
Reinis
MikroTik Support
MikroTik Support
Posts: 87
Joined: Wed Jan 02, 2019 12:14 pm
Location: Latvia
Contact:

Re: LtAP Mini GPS + tracking in map

Thu May 09, 2019 10:17 am

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
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.


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.
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.
 
wesco
just joined
Posts: 1
Joined: Sun Jul 07, 2019 5:54 pm

Re: LtAP Mini GPS + tracking in map

Sun Jul 07, 2019 6:03 pm

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 ;-)
 
timscoop
Trainer
Trainer
Posts: 3
Joined: Wed Nov 24, 2010 4:13 pm
Location: South Africa

Re: LtAP Mini GPS + tracking in map

Fri Aug 16, 2019 12:11 pm

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....
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-g ... tik-s-ltap
 
User avatar
mitchellmnr
just joined
Posts: 6
Joined: Tue Mar 08, 2016 10:04 pm

Re: LtAP Mini GPS + tracking in map

Fri Nov 15, 2019 12:15 am

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
 
oskarsk
MikroTik Support
MikroTik Support
Posts: 60
Joined: Mon May 13, 2019 9:41 am

Re: LtAP Mini GPS + tracking in map

Fri Nov 15, 2019 10:31 am

Serial0 is a console port, you need to use Serial1.
 
User avatar
mitchellmnr
just joined
Posts: 6
Joined: Tue Mar 08, 2016 10:04 pm

Re: LtAP Mini GPS + tracking in map

Fri Nov 15, 2019 10:43 am

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
 
UpRunTech
Member Candidate
Member Candidate
Posts: 209
Joined: Fri Jul 27, 2012 12:11 pm

Re: LtAP Mini GPS + tracking in map

Fri Nov 15, 2019 1:39 pm

I have the LtAP mini and a the LTE module working nicely with the excellent Traccar project (https://www.traccar.org/) posting OsmAnd messages with https. I originally was trying to use Thingsboard sending JSON messages but after some frustrations with that project I quickly discovered Traccar and got it all working very quickly.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Tue Nov 19, 2019 8:55 am

Mitchell,

valid: no
satellites: 0
fix-quality: 0

Did you do it while device is turned off? GPS antenna is an active/powered antenna, connecting it to a live unit can cause damage to the GPS module.
 
User avatar
mitchellmnr
just joined
Posts: 6
Joined: Tue Mar 08, 2016 10:04 pm

Re: LtAP Mini GPS + tracking in map

Thu Dec 12, 2019 11:30 am

@normis

Made sure I plugged it in while powered off, then switched the unit on.
Left it for hours, nothing.
Left it in direct skyview, nothing.

Passive antenna - https://mikrotik.com/product/acgpsa
 
User avatar
mitchellmnr
just joined
Posts: 6
Joined: Tue Mar 08, 2016 10:04 pm

Re: LtAP Mini GPS + tracking in map

Sun Feb 02, 2020 9:51 pm

Hey @normis

Any ideas?

It's been months and I still can't get it to work :(
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Mon Feb 03, 2020 10:31 am

Forum is not the best place to get indepth technical analysis, make a supout.rif file and email it to support@mikrotik.com, maybe some bigger issue can be seen in the debug info.
 
gpsmap
just joined
Posts: 4
Joined: Mon Nov 30, 2020 11:30 am

Re: LtAP Mini GPS + tracking in map

Fri Jan 29, 2021 8:41 am

Hi, mikrotik gps tracker script https://www.youtube.com/watch?v=cFSEs5wWGTU
 
gpsmap
just joined
Posts: 4
Joined: Mon Nov 30, 2020 11:30 am

Re: LtAP Mini GPS + tracking in map

Fri Jan 29, 2021 8:44 am

www.gpsmap.am gps monitoring server
https://www.youtube.com/watch?v=cFSEs5wWGTU
______________________________________________________
Script
______________________________________________________

:local serverURL "https://gpsmap.am/server/api/api_loc.php"
:local fakeImei "123456789123456"
:local SIMslot "0"
:local button "0"

:global isDebug


# :put $isDebug - check current state
# :set $isDebug "terminal" - log to terminal
# :set $isDebug "off" - logging off

# Current Debug status
:set $isDebug "off"



:local gpsDateTime
:local lat
:local lon
:local alt
:local gpsSpeed
:local bearing
:local gpsValid
:local sats
:local hdop
:local DateTime
:local outputURL


#Check and set coordinate format and get data from GPS
:if ( [/system gps get coordinate-format ] != "dd") do={/system gps set coordinate-format=dd}


/system gps monitor once do={
:set $gpsDateTime $("date-and-time")
:set $lat [:pick $("latitude") 0 7]
:set $lon [:pick $("longitude") 0 8]
:set $alt $("altitude")
:set $gpsSpeed $("speed")
:set $bearing $("true-bearing")
:set $gpsValid $("valid")
:set $sats $("satellites")
:set $hdop $("horizontal-dilution")}

:set $alt [:pick $alt 0 [:find $alt "."]]
:set $gpsSpeed ([:pick $gpsSpeed 0 [:find $gpsSpeed "."]].".0")
:set $bearing ([:pick $bearing 0 [:find $bearing "."]].".0")

# Reformating date and time.
:local day [ :pick $gpsDateTime 4 6 ]
:local month [ :pick $gpsDateTime 0 3 ]
:local year [ :pick $gpsDateTime 7 11 ]
:local time [ :pick $gpsDateTime 12 19]
:local DateTime "$year-$month-$day $time"

:set $outputURL ("$serverURL?imei=$fakeImei&dt=$DateTime&lat=$lat&lng=$lon&altitude=$alt&angle=$bearing&speed=$gpsSpeed&loc_valid=1")

:if ($isDebug = "terminal") do={
:put $gpsDateTime
:put $DateTime
:put $lat
:put $lon
:put $alt
:put $gpsSpeed
:put $bearing
:put $gpsValid
:put $sats
:put $hdop
:put $serverURL
:put $fakeImei
:put $battVoltage
:put $SIMslot
:put $button
:put $outputURL
}

/tool fetch mode=http url="$outputURL" output=none
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: LtAP Mini GPS + tracking in map

Fri Jan 29, 2021 8:48 am

Really nice example, thanks for sharing the video!
 
gpsmap
just joined
Posts: 4
Joined: Mon Nov 30, 2020 11:30 am

Re: LtAP Mini GPS + tracking in map

Fri Jan 29, 2021 9:04 am

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
—————————————————————————————————————————————
change the port speed

Who is online

Users browsing this forum: Amazon [Bot], anav, Google [Bot], sindy, ywlhlp and 77 guests