Geo Location Scripting Issue
-
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 conversionI 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 -
-
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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login