right very simple one for one of you scripting gods lol
firstly I'm using Mikrotik router boards and I have a a GPS fitted to a few of them and for a bit of a mess about was thinking on using them to track a few assets mainly out of interest. I saw a script which I guess would do the job but..
transport = CreateSNMPTransport($node);
if (transport == null) {
return null;
}
lat = SNMPGetValue(transport, ".1.3.6.1.4.1.14988.1.1.12.3.0");
long = SNMPGetValue(transport, ".1.3.6.1.4.1.14988.1.1.12.2.0");
if (lat == null || long == null) {
return null;
}
println lat;
println long;
geoLoc =new GeoLocation(lat, long, 1);
$node->setGeoLocation(geoLoc);
return 0;
but I get this as an error. which seems a little odd I suspect its the '' at the end so tried to use the replace function but that doesn't work and I get Function not found as a returned error
N 00 00' 0.000''
W 0 00' 0.000''
Error 4 in line 15: Bad arithmetic conversion
I also tried to strip the chars with no real effect.. oddly enough if I copy and paste the returned values (not including the '') into the geo location on the device properties it works fine but I really want to automate this process to be fair.
Thanks
Rhodri
after creating a transformation script to test to see if its an issue with the script from before I mean its quite simple...
return replace(" 232 "," ","");
I get this as an error
Error 11 in line 1: Function not found
Hi,
NXSL function "replace" was added only in 3.9 branch, which is not released yet.
As for original geolocation issue - geolocation object constructor expects two floating point numbers as latitude and longitude. You have to manually convert d m' s" format into degrees.
Best regards,
Victor