Oeps, be prepared to pay him some % of this… ![]()
Great topic though!
hello
I’m trying to use this script - but no good .
I get in google maps that I’m in the middle of the ocean - well I’m not…
why is it ?
and how can i fix this?
when I open the klm file - I can see that he put this values in the coordinates -4.2 , 2.800
please help ?
Thank you,
what script?
What do you see in the “/system gps” menu? Does it show correct coordinates?
Also do you have a gps.txt file in the files folder? You must first make the file with the monitor command:
/system gps monitor file=gps.txt
yes , they are correct.
and I made a file call gps.txt
what is inside that file? paste here the full contents
may/14/2012 13:28:40 by RouterOS 5.7
software id = XH03-CEG9
date-and-time: may/14/2012 10:28:40
latitude: N ** *' **.168''
longitude: E ** **' **.168''
altitude: 59.500000m
speed: 0.000000 km/h
bearing: none
valid: yes
satellites: 4
Maybe ask this in the original script topic. I have merged your topic with that one, hopefully the author will be able to help
I’m the author. What is the problem? Is the hemisphere not correct? Latitude? Longitude?
-4.2 = South latitude 4 degrees 12 minutes (approx)
2.800 = East longitude 2 degrees 48 minutes (approx)
yes, points to the ocean.
David1234, post your actual coordinates, you are hiding them, so we can’t see which calculation goes wrong
@mchapman: I missed your post about OpenStreetMaps. I took a look at the site, but haven’t found the format yet. If you are still interested in that, let me know.
I found and tested the format for OpenStreetMaps, and the conversion seems very simple. You would use the same decimal format as Google Maps, just sent a little different. Here is the conversion of the lat/long of the current “ocean” location.
http://www.openstreetmap.org/
?lat=-4.2&lon=2.800&zoom=4&layers=M
Adjust the “zoom” number to zoom in. It will take zoom numbers up to 19.
edit: I split the link into two parts so you can see the format easier.
There was a bug in the creation of the Google Maps URL. There is now a plus sign between the latitude and longitude. I also added the link in the email for OpenStreetMaps.
The wiki article has been corrected, but I have no GPS to check it real time. I am going by gps.txt files donated by users. Please let me know if this corrects the problem.
http://wiki.mikrotik.com/wiki/GPS_text_file_converter_to_Google_Earth/Maps
Here is the gps.txt file I used. It is the Destin, Florida airport.
jul/26/2010 14:32: 8 by RouterOS 5.0beta4
software id = SYPQ-LP73
date-and-time: jul/26/2010 04:32:07
longitude: “W 86 28’ 26’'”
latitude: “N 30 24’ 00’'”
altitude: “223.800003m”
speed: “0.000000 km/h”
valid: yes
satellites: 8
The seconds in the lat/long is not a double quote("), It is two single quotes (').
this is what I get in the E-mail
Move to http://maps.google.com?q=E4.8500S2.833
this is what I get in the kml file
-4.8500,-2.833
and this is the lat/long from the gps
latitude: N 32 5’ 21.12’’
longitude: E 34 51’ 29.12’’
thanks ,
one more thing:
when I try to run the script
in the terminal
I get
admin@3GRouter] > :global kmlout “<xml version="1.0" encoding="UTF-8">
[admin@3GRouter] > <kml xmlns="http://www.opengis.net/kml/2.2\”>
expected command name (line 1 column 1)
[admin@3GRouter] >
expected command name (line 1 column 3)
[admin@3GRouter] > My router
expected command name (line 1 column 5)
[admin@3GRouter] > Mobiles location
expected command name (line 1 column 5)
[admin@3GRouter] >
expected command name (line 1 column 5)
[admin@3GRouter] > $coordinates
expected command name (line 1 column 7)
[admin@3GRouter] >
expected command name (line 1 column 5)
[admin@3GRouter] >
expected command name (line 1 column 3)
[admin@3GRouter] >
expected command name (line 1 column 1)
[admin@3GRouter] > ";
expected command name (line 1 column 1)
[admin@3GRouter] >
[admin@3GRouter] > :if (valid) do={
{… :global oldpos;
why did you just paste an XML file in the console? you are not supposed to be doing that
which xml file?
where do I need to put him and from where is he?
- all I saw is to create 2 files :gps.txt , gps.kml
I edited the wiki code yesterday. It has changed since you downloaded it. If you use the new code on the wiki, you should get this in the email with the gps.kml attachment. The gps.txt file I used had the coordinates for Destin airport.
Move to > http://maps.google.com?q=N30.4000+W86.4738
http://www.openstreetmap.org/?lat=+30.4000&lon=-86.4738&zoom=8&layers=M
Note the plus sign (+) between the lat and lon, and the openstreetmap link.
I recommend downloading the code again. There were other changes I made to remove an incorrect hemisphere bug.
edit: If you still have trouble, post your entire gps.txt file. I will try that here and see if I can debug it.
it’s doesn’t work for me
give me many errors
I have’ copy it and when I try to run it
this is what I get
:global gpstext [/file get gps.txt contents];
[admin@3GRouter] > :local longstart [:find $gpstext “longitude” -1];
[admin@3GRouter] > :local longend [:find $gpstext “\n” $longstart];
syntax error (line 1 column 38)
[admin@3GRouter] > :local latstart [:find $gpstext “latitude” -1];
[admin@3GRouter] > :local latend [:find $gpstext “\n” $latstart];
syntax error (line 1 column 37)
[admin@3GRouter] > :local validstart [:find $gpstext “valid” -1];
[admin@3GRouter] > :local validend [:find $gpstext “\n” $validstart];
syntax error (line 1 column 39)
[admin@3GRouter] > :local valid false;
[admin@3GRouter] >
[admin@3GRouter] > :if ([:find $gpstext “yes” $validstart] > 0) do={:set valid tru
e;};
syntax error (line 1 column 29)
[admin@3GRouter] >
[admin@3GRouter] >
[admin@3GRouter] > :global longitude [:pick $gpstext ($longstart + 12) $longend];
syntax error (line 1 column 37)
[admin@3GRouter] > :local degreestart [:find $longitude " " -1];
syntax error (line 1 column 28)
[admin@3GRouter] > :local minutestart [:find $longitude " " $degreestart];
syntax error (line 1 column 28)
[admin@3GRouter] > :local secondstart [:find $longitude “'” $minutestart];
syntax error (line 1 column 28)
[admin@3GRouter] > :local secondend [:find $longitude “'” $secondstart];
syntax error (line 1 column 26)
[admin@3GRouter] >
[admin@3GRouter] > :local longdegree;
[admin@3GRouter] > :local longdegreelink;
[admin@3GRouter] >
[admin@3GRouter] > :if ([:pick $longitude 0 1] = “W”) do={
syntax error (line 1 column 14)
[admin@3GRouter] > :set longdegree “-”;
expected variable name (line 1 column 10)
[admin@3GRouter] > :set longdegreelink “W”;
expected variable name (line 1 column 10)
[admin@3GRouter] > } else={
[admin@3GRouter] > :set longdegree “+”;
expected variable name (line 1 column 10)
[admin@3GRouter] > :set longdegreelink “E”;
expected variable name (line 1 column 10)
[admin@3GRouter] > };
[admin@3GRouter] >
[admin@3GRouter] > :set longdegree ($longdegree . [:pick $longitude 2 $minutestart
]);
expected variable name (line 1 column 6)
[admin@3GRouter] > :set longdegreelink ($longdegreelink . [:pick $longitude 2 $min
utestart]);
expected variable name (line 1 column 6)
[admin@3GRouter] > :local longmin [:pick $longitude ($minutestart + 1) $secondstar
t];
syntax error (line 1 column 24)
[admin@3GRouter] > :local longsec [:pick $longitude ($secondstart + 2) $secondend]
;
syntax error (line 1 column 24)
[admin@3GRouter] > :local longfract ((([:tonum $longmin] * 6000) + ([:tonum $longs
ec] * 100)) / 36);
syntax error (line 1 column 30)
[admin@3GRouter] > :global newlong ($longdegree . “.” . $longfract);
syntax error (line 1 column 19)
[admin@3GRouter] > :global newlonglink ($longdegreelink . “.” . $longfract);
syntax error (line 1 column 23)
[admin@3GRouter] >
[admin@3GRouter] > :global latitude [:pick $gpstext (latstart + 11) $latend];
syntax error (line 1 column 51)
[admin@3GRouter] > :set degreestart [:find $latitude " " -1];
expected variable name (line 1 column 6)
[admin@3GRouter] > :set minutestart [:find $latitude " " $degreestart];
expected variable name (line 1 column 6)
[admin@3GRouter] > :set secondstart [:find $latitude “'” $minutestart];
expected variable name (line 1 column 6)
[admin@3GRouter] > :set secondend [:find $latitude “'” $secondstart];
expected variable name (line 1 column 6)
[admin@3GRouter] >
[admin@3GRouter] > :local latdegree;
[admin@3GRouter] > :local latdegreelink;
[admin@3GRouter] >
[admin@3GRouter] > :if ([:pick $latitude 0 1] = “N”) do={
syntax error (line 1 column 14)
[admin@3GRouter] > :set latdegree “+”;
expected variable name (line 1 column 10)
[admin@3GRouter] > :set latdegreelink “N”;
expected variable name (line 1 column 10)
[admin@3GRouter] > } else={
[admin@3GRouter] > :set latdegree “-”;
expected variable name (line 1 column 10)
[admin@3GRouter] > :set latdegreelink “S”;
expected variable name (line 1 column 10)
[admin@3GRouter] > };
[admin@3GRouter] >
[admin@3GRouter] > :set latdegree ($latdegree . [:pick $latitude 2 $minutestart]);
expected variable name (line 1 column 6)
[admin@3GRouter] > :set latdegreelink ($latdegreelink . [:pick $latitude 2 $minute
start]);
expected variable name (line 1 column 6)
[admin@3GRouter] > :local latmin [:pick $latitude ($minutestart + 1) $secondstart]
;
syntax error (line 1 column 23)
[admin@3GRouter] > :local latsec [:pick $latitude ($secondstart + 2) $secondend];
syntax error (line 1 column 23)
[admin@3GRouter] > :local latfract ((([:tonum $latmin] * 6000) + ([:tonum $latsec]
- 100)) / 36);
syntax error (line 1 column 29)
[admin@3GRouter] > :global newlat ($latdegree . “.” . $latfract);
syntax error (line 1 column 18)
[admin@3GRouter] > :global newlatlink ($latdegreelink . “.” . $latfract);
syntax error (line 1 column 22)
[admin@3GRouter] >
[admin@3GRouter] > :global coordinates ($newlong . “,” . $newlat);
syntax error (line 1 column 23)
[admin@3GRouter] >
[admin@3GRouter] > :global linkout "http://maps.google.com
– name of the new global variable
– new value of variable
[admin@3GRouter] > :global linkout “http://maps.google.comq=$newlonglink+$newlatli
nk”;
expected end of command (line 1 column 42)
[admin@3GRouter] > :global SMlinkout "http://www.openstreetmap.org/
– name of the new global variable
– new value of variable
[admin@3GRouter] > :global SMlinkout “http://www.openstreetmap.org/lat=$newlat&lon
=$newlong&zoom=8&layers=M”;
expected end of command (line 1 column 53)
[admin@3GRouter] >
[admin@3GRouter] > :global kmlout "<
– name of the new global variable
– new value of variable
[admin@3GRouter] > :global kmlout "<xml version="1.0" encoding="UTF-8"
– name of the new global variable
– new value of variable
[admin@3GRouter] > :global kmlout “<xml version="1.0" encoding="UTF-8">
[admin@3GRouter] > <kml xmlns="http://www.opengis.net/kml/2.2\”>
expected command name (line 1 column 1)
[admin@3GRouter] >
expected command name (line 1 column 3)
[admin@3GRouter] > My router
expected command name (line 1 column 5)
[admin@3GRouter] > My router’s location
expected command name (line 1 column 5)
[admin@3GRouter] >
expected command name (line 1 column 5)
[admin@3GRouter] > $coordinates
expected command name (line 1 column 7)
[admin@3GRouter] >
expected command name (line 1 column 5)
[admin@3GRouter] >
expected command name (line 1 column 3)
[admin@3GRouter] >
expected command name (line 1 column 1)
[admin@3GRouter] > “;
expected command name (line 1 column 1)
[admin@3GRouter] >
[admin@3GRouter] > :if (valid) do={
{… :global oldpos;
{…
{… :if ($oldpos != $coordinates) do={
syntax error (line 4 column 22)
[admin@3GRouter] > /file set [/file find name=gps.kml] contents=$kmlout
[admin@3GRouter] > /tool e-mail
[admin@3GRouter] /tool e-mail> send to=$email subject=“Router move” body=”
Move to $linkout\r\n$SMlinkout" file=gps.kml
syntax error (line 1 column 18)
[admin@3GRouter] /tool e-mail> :set oldpos $coordinates;
expected variable name (line 1 column 14)
[admin@3GRouter] /tool e-mail> };
[admin@3GRouter] /tool e-mail> } else={
[admin@3GRouter] /tool e-mail> /tool e-mail
[admin@3GRouter] /tool e-mail> send to=$email subject=“Router gps positio
n invalid” body=“Router gps position invalid”
syntax error (line 1 column 19)
[admin@3GRouter] /tool e-mail> };
how can it be?
what have I done wrong?
Give me a few minutes to check the code. I may have made a typo or two editing the code. I will download that copy and check it.
Add: I checked it and did find one error. The Google maps URL had the lat and lon backwards (latitude is supposed to be first), but should not have cause your errors. I changed that and the email address, and it worked. I modified the wiki code again just now to switch the two variables. It should have been this.
:global linkout "http://maps.google.com?q=$newlatlink+$newlonglink";