Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Geo Location Scripting Issue

Geo Location Scripting Issue

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 21.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    R
    rhodri
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • R
      R
      rhodri
      wrote on last edited by
      #2

      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
      
      1 Reply Last reply
      0
      • V
        V
        Victor Kirhenshtein
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        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
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        Powered by NodeBB Contributors
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups