Javascript function to calculate distance between map spots

  • Hi,

    I'm trying to get this to work with:


    And:

    Code
    js(distance(%2,%3,%4,%5,K));
    trace(get(dist));


    But it's returning a null value in the trace. Anyone any ideas?

  • Hi beek,

    I am not an expert, but *rolleyes* ...
    I think the return statement has nothing to do here (should be useful to return a value to a javascript function)... Also, if I am not on mistake the return ends the function so the following line code is not executed...
    So, try this:

    Hope this help...

    I am curios to see the usage of your code. What is it for? ...

    SAlut.

  • Cheers Michel,

    I solved it with:

    return krpano().set("dist",dist);


    It's to work out distances between mapspot lat and longs - so I can tell the user how far away things are!

    p.s. it's not true - you are an expert!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!